fix bug: midway join confuse the bot

This commit is contained in:
JerryXiao 2018-12-20 16:41:06 +08:00
parent 4639bf77bf
commit 8e95f58948
Signed by: Jerry
GPG Key ID: 9D9CE43650FF2BAA
1 changed files with 4 additions and 1 deletions

5
bot.py
View File

@ -468,7 +468,10 @@ async def new_msg_handler(event):
logger.info('Bot: Game started. I\'m the first player.')
game.start_game()
logger.info('Bot: It\'s my turn.')
if game.is_playing and game.joined and get_peer_id(unochat) in game.joined:
if game.joined and get_peer_id(unochat) in game.joined:
if not game.is_playing:
logger.info('Bot: Game started a long time ago. I joined midway.')
game.start_game()
await inline_query()
else:
logger.info('I\'m not playing in {} - {}'.format(full_info[1].title, get_peer_id(unochat)))