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

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.') logger.info('Bot: Game started. I\'m the first player.')
game.start_game() game.start_game()
logger.info('Bot: It\'s my turn.') 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() await inline_query()
else: else:
logger.info('I\'m not playing in {} - {}'.format(full_info[1].title, get_peer_id(unochat))) logger.info('I\'m not playing in {} - {}'.format(full_info[1].title, get_peer_id(unochat)))