From 91947abce0c88926d0f970f22e4503344eec9be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Thu, 2 Jun 2016 15:51:07 +0200 Subject: [PATCH] remove old, empty games --- game_manager.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/game_manager.py b/game_manager.py index 416096f..75620b0 100644 --- a/game_manager.py +++ b/game_manager.py @@ -47,6 +47,11 @@ class GameManager(object): if chat_id not in self.chatid_games: self.chatid_games[chat_id] = list() + # remove old games + for game in list(self.chatid_games[chat_id]): + if not game.players: + self.chatid_games[chat_id].remove(game) + self.chatid_games[chat_id].append(game) return game