limit timer resetting even further

This commit is contained in:
Jannes Höke 2016-05-08 18:38:31 +02:00
parent ae311ea0cf
commit 9b62f9b116

15
bot.py
View file

@ -485,11 +485,6 @@ def process_result(bot, update):
last_anti_cheat = player.anti_cheat last_anti_cheat = player.anti_cheat
player.anti_cheat += 1 player.anti_cheat += 1
if player.waiting_time < 90:
player.waiting_time = 90
send_async(bot, chat_id, text="Waiting time for %s has been reset to "
"90 seconds" % display_name(user))
if result_id in ('hand', 'gameinfo', 'nogame'): if result_id in ('hand', 'gameinfo', 'nogame'):
return return
elif len(result_id) == 36: # UUID result elif len(result_id) == 36: # UUID result
@ -499,14 +494,17 @@ def process_result(bot, update):
text="Cheat attempt by %s" % display_name(player.user)) text="Cheat attempt by %s" % display_name(player.user))
return return
elif result_id == 'call_bluff': elif result_id == 'call_bluff':
reset_waiting_time(bot, chat_id, player)
do_call_bluff(bot, chat_id, game, player) do_call_bluff(bot, chat_id, game, player)
elif result_id == 'draw': elif result_id == 'draw':
reset_waiting_time(bot, chat_id, player)
do_draw(game, player) do_draw(game, player)
elif result_id == 'pass': elif result_id == 'pass':
game.turn() game.turn()
elif result_id in c.COLORS: elif result_id in c.COLORS:
game.choose_color(result_id) game.choose_color(result_id)
else: else:
reset_waiting_time(bot, chat_id, player)
do_play_card(bot, chat_id, game, player, result_id, user) do_play_card(bot, chat_id, game, player, result_id, user)
if game in gm.chatid_games.get(chat_id, list()): if game in gm.chatid_games.get(chat_id, list()):
@ -514,6 +512,13 @@ def process_result(bot, update):
display_name(game.current_player.user)) display_name(game.current_player.user))
def reset_waiting_time(bot, chat_id, player):
if player.waiting_time < 90:
player.waiting_time = 90
send_async(bot, chat_id, text="Waiting time for %s has been reset to "
"90 seconds" % display_name(player.user))
def do_play_card(bot, chat_id, game, player, result_id, user): def do_play_card(bot, chat_id, game, player, result_id, user):
card = c.from_str(result_id) card = c.from_str(result_id)
game.play_card(card) game.play_card(card)