From 041f3e63118837acaa2316139dd9ca6c796a79e6 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Thu, 23 Dec 2021 17:09:15 +0100 Subject: Refactor GameManager and add control over game creation GameManager had a method called join_game ; which was not actually doing any joining. Instead, it was just returning a reference to the game that would match the specified game name and language. In case the game would not exist, it would be created before being returned. The function is now renamed find_by_name. Also a new parameter "create" has been added. It is a boolean that controls whether a game would be created if it does not exist. Signed-off-by: Olivier Gayot --- swiftstory/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'swiftstory/client.py') diff --git a/swiftstory/client.py b/swiftstory/client.py index c3a2aff..437a3f9 100644 --- a/swiftstory/client.py +++ b/swiftstory/client.py @@ -24,7 +24,7 @@ class Client: lang = 'en' try: - game = self.game_manager.join_game(game_name, lang) + game = self.game_manager.find_by_name(game_name, lang) except UnsupportedLanguage as e: raise JoinError(f"unsupported language: {str(e)}") from e # XXX self.game will be assigned by game.try_join() -- cgit v1.2.3