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>
Created get_context_user() helper function to safely extract the user from
either Context or Interaction objects. This prevents AttributeError issues
when hybrid commands are invoked as slash commands.
Hybrid commands receive commands.Context (with .author) when invoked with
prefix commands, but discord.Interaction (with .user) when invoked as slash
commands. The helper function handles both cases transparently.
Updated all affected hybrid commands:
- /branding-pd (cogs/players.py, cogs/players_new/team_management.py)
- /pullroster (cogs/players.py, cogs/players_new/team_management.py)
- /newsheet (cogs/economy_new/team_setup.py)
- /lastpack (cogs/economy_new/packs.py)
This follows the same pattern as the owner_only() fix and provides a
consistent, maintainable solution for all hybrid commands.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The owner_only() function was accessing ctx.author.id, which caused an
AttributeError when called with Interaction objects from slash commands
(which use .user instead of .author).
Updated both utils.py and helpers/utils.py to handle both Context and
Interaction objects by checking for .user first, then falling back to
.author for backward compatibility with traditional commands.
Fixes: Command 'reset-image' raised an exception: AttributeError:
'Interaction' object has no attribute 'author'
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Multiple fixes to resolve PlayNotFoundException and lineup initialization errors:
1. gauntlets.py:
- Fixed Team object subscriptable errors (use .id instead of ['id'])
- Added fallback cardsets (24, 25, 26) for Event 9 RP shortage
- Fixed draft_team type handling (can be Team object or dict)
2. cogs/gameplay.py:
- Fixed gauntlet game creation flow to read field player lineup from sheets
- Catches LineupsMissingException when SP not yet selected
- Instructs user to run /gamestate after SP selection
3. utilities/dropdown.py:
- Fixed SelectStartingPitcher to create own session instead of using closed session
- Store game/team IDs instead of objects to avoid detached session issues
- Added exception handling for failed legality check API calls
These changes fix the issue where gauntlet games would fail to initialize
because the SP lineup entry wasn't being committed to the database.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixed missing draft configuration for Event ID 9 "Live 25" gauntlet that was causing crashes when users tried to start a gauntlet run.
Changes:
- Added cardset configuration for Event 9 (cardsets 27, 28, 29)
- Added Event 9 to max_counts progressive difficulty logic
- Added Event 9 to draft_loop() events list
- Opponent configuration for Event 9 was already present
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements defensive error handling for WPA (Win Probability Added) calculations when rare game states are missing from the static lookup table. The safe_wpa_lookup() function uses a three-tier fallback strategy: exact lookup, bases-empty fallback, and 0.0 default value.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>