From fc51c391018e83e86f84be355ee2a55aed10e963 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sun, 19 Apr 2020 16:50:25 +0800 Subject: [PATCH] allow only one game perchat --- bot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bot.py b/bot.py index 72c2d65..89a3272 100644 --- a/bot.py +++ b/bot.py @@ -77,6 +77,16 @@ def new_game(update: Update, context: CallbackContext): else: + try: + _game = gm.chatid_games[chat_id][-1] + except (KeyError, IndexError): + pass + else: + send_async(bot, chat_id, + text=_("There is already a game running in this chat. Join the " + "game with /join")) + return + if update.message.chat_id in gm.remind_dict: for user in gm.remind_dict[update.message.chat_id]: send_async(bot,