From c2bbf94925fbe0afc8611222a72a308445e52004 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Mon, 10 Nov 2025 09:11:37 -0600 Subject: [PATCH] CLAUDE: Fix get_roster_sheet() to handle both dict and Team objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- helpers/utils.py | 10 ++++++++-- utils.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/helpers/utils.py b/helpers/utils.py index d956435..9fc70e3 100644 --- a/helpers/utils.py +++ b/helpers/utils.py @@ -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: diff --git a/utils.py b/utils.py index bb71a96..e8e5f5d 100644 --- a/utils.py +++ b/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: