The players/random API endpoint only accepts min_rarity and max_rarity,
not rarity. The previous fix silently did nothing because FastAPI ignores
unknown query parameters.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix pack distribution to use exact rarity targeting (rarity=0 for
Replacement, rarity=1 for Reserve) instead of max_rarity=1 which
matched both tiers; applied to cogs/economy.py and
cogs/economy_new/team_setup.py
- Add get_away_team() and get_home_team() async methods to StratGame
dataclass, delegating to get_game_team() with the appropriate
team_id; remove stale TODO comment from Game model
- Standardize home-run detection in complete_play(): set
batter_final = batter_to_base when not None before the HR check,
then only check batter_final == 4 (removes redundant batter_to_base
path and the patch comment)
Closes#20, Closes#21, Closes#22
Co-Authored-By: Claude Sonnet 4.6 <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>