Commit Graph

213 Commits

Author SHA1 Message Date
Cal Corum
584a8a95ab Fix slash command decorators using wrong prefix command checks
Bug: Several slash commands (@app_commands.command) were using prefix command
decorators (@commands.has_any_role, @commands.check) which don't work with
app_commands. This caused errors caught by the global error handler, resulting
in "Unknown interaction" (404) errors being displayed before the command executed.

Affected commands:
- /comeonmanineedthis: Both role and channel checks were wrong
- /selldupes: Channel check was wrong
- /team: Channel check was wrong

Fix:
- Created app_legal_channel() decorator in helpers.py for slash commands
- Changed @commands.has_any_role to @app_commands.checks.has_any_role
- Changed @commands.check(legal_channel) to @app_legal_channel()

Bumps version to 1.7.5

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 07:29:08 -06:00
Cal Corum
1e75f1baba CLAUDE: Add news-ticker message when gauntlet runs end with 2 losses
Users reported that end-of-run messages to #pd-news-ticker were no longer
appearing when gauntlet teams lost their second game. The news-ticker
announcement was only happening for 10-win completions, not 2-loss endings.

Changes:
- Updated end_run() to accept bot and main_team parameters
- Added send_to_channel() call when losses == 2 (natural run end)
- Skips news-ticker for manual resets (force_end=True)
- Updated post_result() to pass bot and main_team to end_run()
- Updated manual reset calls to explicitly pass force_end=True

Now when a gauntlet team loses their second game, #pd-news-ticker will
show: "The **[Team]** have completed their **[Event]** Gauntlet run
with a final record of [wins]-[losses]."

The draft completion message to news-ticker was already working correctly
at cogs/players_new/gauntlet.py:178-183.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 09:17:55 -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
c043948238 CLAUDE: Fix gauntlet game creation and Event 9 issues
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>
2025-11-09 18:56:38 -06:00
Cal Corum
0e3b98eb65 S10 Updates + PR Bugfix 2025-11-09 06:12:46 -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
Cal Corum
3debfd6e82 Catchup commit
Includes discord_ui refactor, testing overhaul, addition of
2025-07-22 09:22:19 -05:00
Cal Corum
65abc8ed55 Remove outdate image links
Add S3 image links
Pull all fielding ratings at game start
2025-06-04 09:54:13 -05:00
Cal Corum
a4adf50ca1 Added discord bot object to complete game function 2025-06-01 09:44:16 -05:00
Cal Corum
b3fa68b80e Bug fixes for uncapped doubles 2025-05-30 21:16:51 -05:00
Cal Corum
17680a2348 Added /substitution defense 2025-05-30 01:19:45 -05:00
Cal Corum
e9c9a3f392 dictionary to object bug fix 2025-05-29 21:54:46 -05:00
Cal Corum
6a355def4b Season 9 Updates 2025-05-03 19:38:29 -05:00
Cal Corum
cffc9380f1 Replacing 1998 Live with 1998 Season 2025-04-14 16:28:14 -05:00
Cal Corum
cb2637086e Live scorecard fix
Gauntlet entry string fix
2025-03-31 13:54:39 -05:00
Cal Corum
9218bd6047 Update cache reset command
Decrease cache limit to 3 days
Add kickstart live scorecard function
2025-03-09 14:20:30 -05:00
Cal Corum
cf4157a59d Increase scorebug timeout to 8 seconds 2025-03-09 00:58:15 -06:00
Cal Corum
8e35812cd3 Increase concurrent db connections
Decrease timeout on Scorebug buttons to reduce open connections
2025-03-03 22:13:40 -06:00
Cal Corum
9d831a9512 Post gamestate publicly if human team GM runs command 2025-02-23 23:20:54 -06:00
Cal Corum
50895fef90 Show charts on SPD checks
Fix gb chart with OBC 5, 7
Add 1998 to player command
2025-02-10 23:44:05 -06:00
Cal Corum
479a335373 Gauntlet evolution fix 2025-02-09 21:38:19 -06:00
Cal Corum
f6bae8c208 Local db to Postgresql 2025-02-08 04:11:04 -06:00
Cal Corum
d5f2978b01 Update new-game flow 2025-02-06 15:12:12 -06:00
Cal Corum
282a7e7ac2 Added live scorecard functionality
Added new pitcher embed highlighting
2025-02-05 11:30:56 -06:00
Cal Corum
fc130e6a98 Update buffer message for ballpark fly
Bolded new pitcher text
2025-02-03 13:58:51 -06:00
Cal Corum
3b6bcfb186 Beta day 1 bug fixes 2025-02-02 22:01:33 -06:00
Cal Corum
7d54d9ea34 Add unlimited new-game
Add pitcher substitution
Add AI pitcher subs
2025-02-01 21:32:40 -06:00
Cal Corum
4a76d59481 Check for AI fatigue 2025-01-26 02:20:29 -06:00
Cal Corum
36dbde848e new_game_checks refactor 2025-01-24 10:08:11 -06:00
Cal Corum
965ceebd35 Add responders check to dropdowns
Add colors and insults to helpers
Finish /set commands with helpers post /new-game
Add POW check for pitchers
2024-12-27 22:33:25 -06:00
Cal Corum
724b8922f2 Update gauntlet get SP for new objects
Handle gamestates without full lineups
Added /set command for lineup and SP
Fixed uncapped hit bugs
Added league_name property to Games
Fix get_team for gauntlets
Fixed SelectSP dropdown bug
2024-12-27 16:12:25 -06:00
Cal Corum
3db25b177a Refactor new game checks
Trail batter-runner on uncapped hits
2024-12-26 14:36:04 -06:00
Cal Corum
9dbd7896c4 Add PB to catcher string
Fix chaos interaction bug
2024-12-25 15:00:22 -06:00
Cal Corum
7015fb3125 Added baserunning ai notes
Added get_batter_card to gameplay_queries
2024-12-24 21:08:00 -06:00
Cal Corum
fddb06b2fe Mege cleanup 2024-12-24 16:10:44 -06:00
Cal Corum
19cdf969d1 Merge branch 'master' into sqlmodel-alembic-pytests-rebuild 2024-12-24 14:51:59 -06:00
Cal Corum
9ea6829674 Day 1 Pokemon updates 2024-12-24 14:21:33 -06:00
Cal Corum
5f8a422c2c Added Brilliant Stars gauntlet 2024-12-24 00:22:30 -06:00
Cal Corum
7f6472bbc6 Batter subs plus cleanup 2024-12-23 10:09:11 -06:00
Cal Corum
07fcbca866 New sync method 2024-12-18 09:59:39 -06:00
Cal Corum
3d41ec1662 Remove static gauntlet run options 2024-12-18 09:59:27 -06:00
Cal Corum
95ee071ef8 Add DTwentyRoll
Add /log lineout
Add ManagerAi.tag_from_third()
2024-12-06 20:41:38 -06:00
Cal Corum
1e9e79916f Added /log frame-check
Fixed game-summary error
2024-12-06 11:56:56 -06:00
Cal Corum
8118b4a691 Added PO/FO to fielding roll
Complete /log xcheck and /log groundball
2024-12-06 00:46:49 -06:00
Cal Corum
d6d3d7beb0 Log stealing done
Log xchecks started
2024-11-25 13:17:51 -06:00
Cal Corum
073bd04b4b Added RosterLinks to remove card_id from setup process
Add SelectStartingPitcher dropdown
New .sync function
2024-11-23 19:53:48 -06:00
Cal Corum
a4af7652fc ask_confirm bug fix
manual_end_game complete
2024-11-21 10:38:39 -06:00
Cal Corum
7a718d45f0 AbRoll and JumpRoll objects
Add handedness to pitcher/batter
2024-11-20 21:31:31 -06:00
Cal Corum
f7685ff0e3 Added AbRoll and JumpRoll
Added auto_roll and roll_buttons to Game
Added log chaos
2024-11-17 14:57:54 -06:00