Skip to content

Commit

Permalink
Add in game guard for !stats
Browse files Browse the repository at this point in the history
This prevents it from breaking during join phase
  • Loading branch information
skizzerz committed Nov 30, 2024
1 parent 63dc115 commit 7933741
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/gamecmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 7933741

Please sign in to comment.