allow only one game perchat

This commit is contained in:
JerryXiao 2020-04-19 16:50:25 +08:00
parent 7af19fae31
commit fc51c39101
Signed by: Jerry
GPG key ID: 22618F758B5BE2E5

10
bot.py
View file

@ -77,6 +77,16 @@ def new_game(update: Update, context: CallbackContext):
else: 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: if update.message.chat_id in gm.remind_dict:
for user in gm.remind_dict[update.message.chat_id]: for user in gm.remind_dict[update.message.chat_id]:
send_async(bot, send_async(bot,