Commit Graph

13 Commits

Author SHA1 Message Date
Cal Corum
4be6afb541 Add API timeout/retry logic and fix get_team_by_owner for PostgreSQL
- Add APITimeoutError exception and retry logic to db_get
- Add timeout handling to db_post, db_put, db_patch, db_delete
- Fix get_team_by_owner to prefer non-gauntlet team (PostgreSQL migration fix)
- Code formatting cleanup (black)
2026-01-31 15:52:14 -06:00
Cal Corum
565afd0183 Normalize Player.franchise queries to use Team.sname
- Add FRANCHISE_NORMALIZE dict and helper to constants.py
- Update economy.py to normalize team_choice and use sname
- Update helpers/main.py franchise queries to use sname
- Update selectors.py to normalize franchise on player updates

Part of cross-era player matching fix for AI rosters

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 12:01:00 -06:00
Cal Corum
5aa88e4e3d Fix Athletics Team Choice pack KeyError
Add 'Athletics' alias to ALL_MLB_TEAMS, IMAGES['mvp'], and AL_TEAM_IDS
to support both old franchise name ("Oakland Athletics") and new mlbclub
name ("Athletics") after the team's relocation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 16:20:05 -06:00
Cal Corum
c3054971eb Fix /player stats bug - sync helpers/constants.py with root
PD_SEASON was set to 9 in helpers/constants.py while games are
recorded in season 10. This caused /player command to return
no stats for cardset 27 cards since they only have season 10 data.

Changes:
- PD_SEASON: 9 → 10
- SBA_SEASON: 11 → 12
- ranked_cardsets: updated to current cardsets
- Added gauntlet-8 and gauntlet-9 configs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 21:48:30 -06:00
Cal Corum
06ff92df6c Update live cardset IDs to 27 and 28
- LIVE_CARDSET_ID: 24 → 27
- LIVE_PROMO_CARDSET_ID: 25 → 28

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 14:41:18 -06:00
Cal Corum
7bb191dbf4 Add app_legal_channel to helpers package (fixes import error)
Bug: Version 1.7.5 added app_legal_channel to helpers.py but production uses
the helpers/ package which imports from helpers/main.py. This caused:
- NameError: name 'app_legal_channel' is not defined
- ImportError: cannot import name 'app_legal_channel' from 'helpers'

Result: cogs.economy and cogs.players failed to load, causing all slash
commands (including /team, /selldupes, /comeonmanineedthis) to be unavailable.

Fix: Add app_legal_channel() function to helpers/main.py so it's exported
via the helpers package __init__.py.

Bumps version to 1.7.6

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 09:23:27 -06:00
Cal Corum
af49704272 Catchup files 2025-11-11 13:22:06 -06:00
Cal Corum
fb8450f2d2 05 Live Updates 2025-11-10 17:13:02 -06:00
Cal Corum
c2bbf94925 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>
2025-11-10 09:11:37 -06:00
Cal Corum
943dcc9b74 CLAUDE: Add get_context_user() helper for hybrid command compatibility
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>
2025-11-10 09:07:09 -06:00
Cal Corum
c0f9466e54 CLAUDE: Fix /reset-image AttributeError by updating owner_only function
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>
2025-11-10 08:21:17 -06:00
Cal Corum
660c6ad904 Added search functionality to /player command 2025-10-08 14:45:41 -05:00
Cal Corum
b1d05309ef Cogs to Packages Groundwork 2025-08-17 08:46:55 -05:00