From fbb74a4acbe27168b96c7414c5ab6cf2b23f3d96 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 1 Jun 2016 13:52:00 +0200 Subject: [PATCH] =?UTF-8?q?Un=20if=20=5F=5Fdebug=5F=5F=20in=20pi=C3=B9=20f?= =?UTF-8?q?a=20sempre=20bene?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/main.py b/main.py index 534363d..c7602c4 100644 --- a/main.py +++ b/main.py @@ -660,21 +660,22 @@ def role(bot, update): def kill(bot, update): """Uccidi un giocatore in partita.""" - game = findgamebyid(update.message.chat['id']) - if game is not None and game.phase is 'Voting': - if update.message.from_user['id'] == game.adminid: - target = game.findplayerbyusername(update.message.text.split(' ')[1]) - if target is not None: - target.kill() - game.message(bot, s.admin_killed.format(name=target.tusername, - icon=target.role.icon, - role=target.role.name)) + if __debug__: + game = findgamebyid(update.message.chat['id']) + if game is not None and game.phase is 'Voting': + if update.message.from_user['id'] == game.adminid: + target = game.findplayerbyusername(update.message.text.split(' ')[1]) + if target is not None: + target.kill() + game.message(bot, s.admin_killed.format(name=target.tusername, + icon=target.role.icon, + role=target.role.name)) + else: + game.message(bot, s.error_username) else: - game.message(bot, s.error_username) + game.message(bot, s.error_not_admin) else: - game.message(bot, s.error_not_admin) - else: - bot.sendMessage(update.message.chat['id'], s.error_no_games_found, parse_mode=ParseMode.MARKDOWN) + bot.sendMessage(update.message.chat['id'], s.error_no_games_found, parse_mode=ParseMode.MARKDOWN) def delete(bot, update):