From 7933741f804577136427591e7197e26b158d57e5 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Fri, 29 Nov 2024 17:48:18 -0700 Subject: [PATCH] Add in game guard for !stats This prevents it from breaking during join phase --- src/gamecmds.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gamecmds.py b/src/gamecmds.py index d789ff36..3a4806ea 100644 --- a/src/gamecmds.py +++ b/src/gamecmds.py @@ -40,10 +40,12 @@ def stats(wrapper: MessageDispatcher, message: str): LAST_STATS = datetime.now() - try: - player_role = get_main_role(var, wrapper.source) - except ValueError: - player_role = None + player_role = None + if var.in_game: + try: + player_role = get_main_role(var, wrapper.source) + except ValueError: + pass if wrapper.private and var.in_game and player_role in Wolfteam and "src.roles.helper.wolves" in sys.modules: from src.roles.helper.wolves import get_wolflist msg = messages["players_list_count"].format(