CLAUDE: Fix get_roster_sheet() to handle both dict and Team objects
Fixed TypeError: 'Team' object is not subscriptable error occurring at the end of /gauntlet start command when sending completion messages. The get_roster_sheet() function was using dict syntax (team["gsheet"]) but was receiving Team objects from gauntlet commands. Updated the function to handle both dict and Team object formats using isinstance() check. This follows the same pattern as get_context_user() and owner_only() for handling multiple input types gracefully. Fixes: Command 'start' raised an exception: TypeError: 'Team' object is not subscriptable (reported at end of gauntlet draft completion) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
943dcc9b74
commit
c2bbf94925
@ -77,8 +77,14 @@ def get_roster_sheet_legacy(team):
|
||||
|
||||
|
||||
def get_roster_sheet(team):
|
||||
"""Get roster sheet URL for a team."""
|
||||
return f'https://docs.google.com/spreadsheets/d/{team["gsheet"]}/edit'
|
||||
"""
|
||||
Get roster sheet URL for a team.
|
||||
|
||||
Handles both dict and Team object formats.
|
||||
"""
|
||||
# Handle both dict (team["gsheet"]) and object (team.gsheet) formats
|
||||
gsheet = team.get("gsheet") if isinstance(team, dict) else getattr(team, "gsheet", None)
|
||||
return f'https://docs.google.com/spreadsheets/d/{gsheet}/edit'
|
||||
|
||||
|
||||
def get_player_url(team, player) -> str:
|
||||
|
||||
10
utils.py
10
utils.py
@ -74,8 +74,14 @@ def get_roster_sheet_legacy(team):
|
||||
|
||||
|
||||
def get_roster_sheet(team):
|
||||
"""Get roster sheet URL for a team."""
|
||||
return f'https://docs.google.com/spreadsheets/d/{team["gsheet"]}/edit'
|
||||
"""
|
||||
Get roster sheet URL for a team.
|
||||
|
||||
Handles both dict and Team object formats.
|
||||
"""
|
||||
# Handle both dict (team["gsheet"]) and object (team.gsheet) formats
|
||||
gsheet = team.get("gsheet") if isinstance(team, dict) else getattr(team, "gsheet", None)
|
||||
return f'https://docs.google.com/spreadsheets/d/{gsheet}/edit'
|
||||
|
||||
|
||||
def get_player_url(team, player) -> str:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user