From 9b62f9b116f4988fcde234766290304c5d5e2e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Sun, 8 May 2016 18:38:31 +0200 Subject: [PATCH] limit timer resetting even further --- bot.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index 27917df..fecd2dd 100644 --- a/bot.py +++ b/bot.py @@ -485,11 +485,6 @@ def process_result(bot, update): last_anti_cheat = player.anti_cheat 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'): return 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)) return elif result_id == 'call_bluff': + reset_waiting_time(bot, chat_id, player) do_call_bluff(bot, chat_id, game, player) elif result_id == 'draw': + reset_waiting_time(bot, chat_id, player) do_draw(game, player) elif result_id == 'pass': game.turn() elif result_id in c.COLORS: game.choose_color(result_id) else: + reset_waiting_time(bot, chat_id, player) do_play_card(bot, chat_id, game, player, result_id, user) 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)) +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): card = c.from_str(result_id) game.play_card(card)