Features:
- Post injury announcements to #sba-network-news when injuries are logged
- Update #injury-log channel with two embeds:
- All injuries grouped by Major League team with return dates
- All injuries grouped by return week, sorted ascending
- Auto-purge old messages before posting updated injury log
Bug Fixes:
- Fix BaseView interaction_check logic that incorrectly rejected command users
- Old: Rejected if (not user_id match) OR (not in responders)
- New: Allow if (user_id match) OR (in responders)
- Filter None values from responders list (handles missing gmid2)
Changes:
- services/injury_service.py: Add get_all_active_injuries_raw() method
- utils/injury_log.py: New utility for injury channel posting
- views/modals.py: Call injury posting after successful injury logging
- views/base.py: Fix interaction authorization logic
- config.py: Update to Season 13 Players role
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
IL moves (/ilmove) are intra-team transactions that should always be
visible immediately. Only scheduled transactions (/dropadd) need to
remain hidden during the freeze period.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Bug: Transactions were being posted to #transaction-log even when Current.freeze=True.
Transactions should only be posted when Current.freeze=False.
Fix: Added freeze state checks before calling post_transaction_to_log() in both
scheduled (/dropadd) and immediate (/ilmove) submission handlers.
When frozen:
- Transactions are still saved to DB with frozen=True
- NOT posted to #transaction-log (hidden until Saturday processing)
- User sees "Transaction saved during freeze period" message
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
During the draft, teams draft 32 players and then drop to 26. The cap
calculation must account for remaining draft picks:
- max_zeroes = 32 - projected_roster_size (remaining draft picks)
- players_counted = 26 - max_zeroes (how many current players count)
This allows teams to draft expensive players mid-draft knowing they'll
drop cheap ones later. Previously the code was using min(roster_size, 26)
which didn't account for future picks, causing false cap violations.
Example: WAI with 18 players drafting 19th:
- Old (broken): players_counted = 19, sum all players
- New (fixed): max_zeroes = 13, players_counted = 13, only cheapest 13 count
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The get_recent_picks service method was subtracting 1 from overall_end,
but callers were already passing currentpick - 1. This caused the "Last 5
picks" list on the OnTheClock embed to skip the most recently completed
pick (showing picks 2-6 before current instead of 1-5).
Removed the extra subtraction in the service method since callers already
handle the exclusivity of the overall_end parameter.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The manual /draft command was only posting draft cards to the ping_channel,
but not to the result_channel. The auto-draft task correctly posted to both
channels. This fix ensures manual draft picks also post player cards to the
configured result channel for consistent draft result tracking.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
When users select from autocomplete dropdown, Discord sometimes sends
the display text (e.g., "Mason Miller (RP) - 2.50 sWAR") instead of
the value ("Mason Miller"). Added _parse_player_name() to strip the
position and sWAR info from the input.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously, only the draft monitor task posted on-clock announcements
when auto-drafting. Now the /draft command also posts an on-clock
announcement with team role ping after each pick advances.
Changes:
- Added _post_on_clock_announcement method to DraftPicksCog
- Called after advance_pick() in _process_draft_pick
- Posts embed with team info, sWAR, recent picks, and role ping
- Imports roster_service and get_team_salary_cap for sWAR calculation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Bug: The _post_on_clock_announcement method referenced 'guild' without
defining it, causing the role ping to silently fail when posting
on-clock announcements after auto-draft picks.
Fix: Added guild lookup from bot.get_guild(config.guild_id) at the
start of the method.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change sWAR formatting from 1 decimal to 2 decimal places across all displays
- Draft on-clock announcements now ping team role (via team.lname) instead of GM
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Changed write_picks_batch() from 105 individual API calls to 1 batch call
- Builds 2D array covering full pick range and writes in single update_values()
- Eliminates Google Sheets 429 rate limiting during resync operations
- Reduces resync time from ~2 minutes to seconds
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Features:
- Skipped pick support: Teams can make up missed picks
- Google Sheets integration: Auto-sync picks to shared sheet
- Draft pause/resume: Admins can pause/resume draft with timer control
- Auto-draft improvements: Auto-start monitor, post picks to result channel
- Sheet links in draft embeds: Quick access to draft board
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added sheet_url parameter to draft embed functions:
- create_draft_board_embed - "View Full Board" link
- create_admin_draft_info_embed - "View Sheet" link
- create_on_the_clock_embed - "View Full Board" link
- create_on_clock_announcement_embed - "View Full Board" link
Updated all callers to pass the sheet URL from config.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add paused field to DraftData model
- Add pause_draft() and resume_draft() methods to DraftService
- Add /draft-admin pause and /draft-admin resume commands
- Block picks in /draft command when draft is paused
- Skip auto-draft in draft_monitor when draft is paused
- Update status embeds to show paused state
- Add comprehensive tests for pause/resume
When paused:
- Timer is stopped (set to False)
- Deadline is set far in future
- All /draft picks are blocked
- Auto-draft monitor skips processing
When resumed:
- Timer is restarted with fresh deadline
- Picks are allowed again
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The help command creation modal was accepting names with spaces and
special characters (e.g., "scorecard links"), which passed to the API
but caused Pydantic validation errors when reading the records back.
Changes:
- Add regex validation in modal on_submit for topic name and category
- Only allow lowercase letters, numbers, dashes, and underscores
- Show clear error messages with valid examples when validation fails
- Normalize name/category to lowercase before storing
This prevents invalid records from being created in the database.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Auto-draft picks now post the same draft card embed to the result
channel that regular /draft picks do, with a footer indicating the
pick was auto-drafted from the draft list.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
DraftList.from_api_data() now properly calls Player.from_api_data()
for nested player objects, ensuring player.team_id is correctly
extracted from the nested team object. Also fixed validate_cap_space()
unpacking to accept all 3 return values.
Bug: Auto-draft was marking all players as "not available" because
player.team_id was None (None != 547 always True).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add DraftSheetService with write_pick(), write_picks_batch(),
clear_picks_range(), and get_sheet_url() methods
- Integrate sheet writes in /draft command (fire-and-forget pattern)
- Integrate sheet writes in draft_monitor.py for auto-draft picks
- Add /draft-admin resync-sheet command for bulk recovery
- Add sheet link to /draft-status embed
- Add draft_sheet_keys config with env var overrides per season
- Add get_picks_with_players() to draft_pick_service for resync
- Add 13 unit tests for DraftSheetService (all passing)
- Update CLAUDE.md documentation files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
commands/draft/CLAUDE.md:
- Mark all draft commands as implemented (not "pending")
- Document /draft-admin subcommands and auto-start behavior
- Add /draft-on-clock command documentation
- Update status to December 2025
tasks/CLAUDE.md:
- Document smart polling intervals (30s/15s/5s)
- Add auto-start behavior from /draft-admin commands
- Document on-clock announcement embed features
- Update to December 2025
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Teams can now make up missed draft picks when not on the clock:
- Added get_skipped_picks_for_team() to draft_pick_service
- /draft checks for skipped picks when user isn't on the clock
- Uses earliest (lowest overall) skipped pick first
- Shows footer noting "Making up skipped pick" on success
- Does NOT advance draft when using skipped pick
- Fixed duplicate embed when command run in ping channel
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Start draft monitor when timer enabled via /draft-admin timer
- Auto-start monitor when /draft-admin set-pick is used with active timer
- Add _ensure_monitor_running() helper for consistent monitor management
- Create on-clock announcement embed with:
- Team name, pick info, and deadline
- Team sWAR and cap space
- Last 5 picks
- Top 5 roster players by sWAR
- Implement smart polling intervals:
- 30s when >60s remaining
- 15s when 30-60s remaining
- 5s when <30s remaining
- Add get_top_free_agents() to player service
- Fix DraftAdminGroup to accept bot parameter
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Update footer text to list available commands instead of confusing
"manage" message (/draft-list only views, doesn't manage)
- Show updated queue after /draft-list-remove (matches /draft-list-add UX)
- Add helpful footer to /draft-list-clear success message
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- draft_views.py: Use create_base_embed() instead of info() for
Draft Administration embed to keep custom ⚙️ emoji
- charts.py: Same fix for Chart Categories embed with 📊 emoji
EmbedTemplate.info/success/error/warning/loading() methods auto-add
emoji prefixes, so custom emojis should use create_base_embed() instead.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Root Cause Fixes:
- Add _extract_items_and_count_from_response() override to DraftPickService
to handle API returning 'picks' key instead of 'draftpicks'
- Add custom from_api_data() to DraftPick model to handle API field mapping
(origowner/owner/player -> origowner_id/owner_id/player_id)
Enhancements:
- Add timer status to /draft-admin set-pick success message
- Shows relative deadline timestamp when timer active
- Shows "Timer Inactive" when timer not running
Also includes related draft module improvements from prior work.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Major fixes:
- Rename test_url_accessibility() to check_url_accessibility() in
commands/profile/images.py to prevent pytest from detecting it as a test
- Rewrite test_services_injury.py to use proper client mocking pattern
(mock service._client directly instead of HTTP responses)
- Fix Giphy API response structure in test_commands_soak.py
(data.images.original.url not data.url)
- Update season config from 12 to 13 across multiple test files
- Fix decorator mocking patterns in transaction/dropadd tests
- Skip integration tests that require deep decorator mocking
Test patterns applied:
- Use AsyncMock for service._client instead of aioresponses for service tests
- Mock at the service level rather than HTTP level for better isolation
- Use explicit call assertions instead of exact parameter matching
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix DraftPickService to send full model body on PATCH (API requirement)
- Fix DraftListService to use client-side sorting (API doesn't support sort param)
- Fix parameter names: round_start/end -> pick_round_start/end
- Add 53 tests covering DraftService, DraftPickService, DraftListService
- Add draft model tests for DraftData, DraftPick, DraftList
- Add OpenAPI spec URL to CLAUDE.md for API reference
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update SOAK listener tests to match refactored simple string detection
(removed SOAK_PATTERN regex import, now uses ' soak' in text.lower())
- Fix DraftList model tests to provide nested Team/Player objects
(model requires full objects, not just IDs)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Document trade acceptance workflow added in v2.22.0
- Add trade transaction logging documentation
- Update workflow steps to include Accept/Reject UI
- Move completed features from Future to Recent Enhancements
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add multi-team trade acceptance system requiring all GMs to approve
- TradeBuilder tracks accepted_teams with accept_trade/reject_trade methods
- TradeAcceptanceView with Accept/Reject buttons validates GM permissions
- Create transactions when all teams accept (frozen=false for immediate effect)
- Add post_trade_to_log() for rich trade embeds in #transaction-log
- Trade embeds show grouped player moves by receiving team with sWAR
- Add 10 comprehensive tests for acceptance tracking methods
- All 36 trade builder tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add expand_mil_week config (default: 15) for MiL expansion timing
- Add early/late ML and MiL roster limits as config items
- Add offseason roster limits (69/69) for relaxed roster building
- Fix free_agent_team_id to correct value (547)
- Transaction builder now uses config values instead of hard-coded limits
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Previously, only the trade initiator could access the trade builder
because lookups used their Discord user ID. Now any GM whose team
participates in a trade can add players, view, and manage the trade.
Changes:
- Add _team_to_trade_key secondary index mapping team IDs to trade keys
- Add get_trade_builder_by_team() for team-based lookups
- Add clear_trade_builder_by_team() for team-based clearing
- Update add_team/remove_team to maintain secondary index
- Refactor 5 trade commands to use team-based lookups
- Add 9 new tests for multi-GM access functionality
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Remove redundant sba_current_season and pd_current_season config values.
All code now uses sba_season and pd_season, which properly read from
environment variables. Fixes /team command defaulting to Season 12.
- Remove duplicate *_current_season constants from config.py
- Update 100+ references across commands, services, and utils
- sba_season defaults to 13, pd_season defaults to 10
- Environment variables SBA_SEASON/PD_SEASON now work correctly
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implemented comprehensive team branding management system allowing team owners
to update colors and logos for major league, minor league, and dice rolls.
Features:
- Modal-based interactive form input with validation
- Hex color validation with normalization (6 chars, optional # prefix)
- Image URL accessibility testing with aiohttp (5 second timeout)
- Preview + confirmation workflow with ConfirmationView
- Support for both major league and minor league affiliate updates
- Dice color customization for game rolls
- Discord role color sync (non-blocking with graceful fallback)
- Comprehensive error handling and user feedback
Technical Implementation:
- BrandingModal class with 5 optional fields
- Concurrent URL validation using asyncio.gather
- Fixed team_service.update_team() to use PATCH with query parameters
- Enhanced TeamService documentation with correct method signatures
- 33 comprehensive tests (100% passing)
Bug Fixes:
- Fixed modal send timing (immediate response vs deferred)
- Fixed interaction handling for cancel button
- Fixed database API communication (PATCH query params vs PUT JSON)
Files:
- commands/teams/branding.py (NEW - ~500 lines)
- commands/teams/__init__.py (added BrandingCommands registration)
- commands/teams/CLAUDE.md (added comprehensive documentation)
- tests/test_commands_teams_branding.py (NEW - 33 tests)
- services/team_service.py (fixed update_team to use query params)
- VERSION (2.19.2 → 2.20.0)
Docker: manticorum67/major-domo-discord-app-v2:2.20.0
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Corrected API endpoint paths from 'custom_command_creators' to 'custom_commands/creators' to match the database API routing structure.
**Issue**: Users unable to create custom commands due to 404 errors
**Root Cause**: Bot calling /api/v3/custom_command_creators instead of /api/v3/custom_commands/creators
**Solution**: Updated 5 endpoint references in custom_commands_service.py
Fixes:
- Line 547: create_item_in_table() call
- Lines 732, 748: client.put() calls for creator updates
- Lines 762, 768: get_items_from_table_with_params() calls for creator queries
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Initial version: 2.19.1
This file tracks the current version for Docker builds. When building
and pushing new versions, this file will be updated and the commit
will be tagged with the version number.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The @requires_team() decorator was incorrectly treating API errors as "no team"
because get_user_team() was catching all exceptions and returning None.
Changes:
1. get_user_team() now propagates exceptions instead of catching them
- Allows callers to distinguish between "no team found" vs "API error"
- Updated docstring to document the exception behavior
2. @requires_team() decorator now has try-except block
- Returns specific error for "no team" (None result)
- Returns helpful error for API/network issues (exception caught)
- Logs exceptions for debugging
3. league_admin_only() decorator enhanced
- Now supports both slash commands (Interaction) and prefix commands (Context)
- Unified error handling for both command types
4. team_service.py and related updates
- Team model field name corrected: team_abbrev -> abbrev
This fixes the regression where /cc-create was failing with "no team" error
when it should have been showing an API error message or working correctly.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The /cc-create command was immediately creating the custom command after the modal
was submitted, instead of waiting for the user to click the "Create Command" button
in the confirmation view.
Issue: Command handler was calling create_command() service immediately after modal
submission, before user confirmed via the preview buttons.
Fix: Removed premature command creation logic from the command handler. The modal's
on_submit method already shows a preview with confirmation buttons, and the
CustomCommandCreateConfirmationView.confirm_create button handler properly creates
the command only when the user clicks "Create Command".
Flow now correctly:
1. User submits modal with command details
2. Preview displays with "Create Command" and "Cancel" buttons
3. Command is only created when user clicks "Create Command" button
4. User can cancel without creating anything
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Updated the /admin-process-transactions command to follow the proper
service layer architecture instead of accessing API clients directly.
Changes:
- Use transaction_service.get_all_items() to fetch transactions
- Use player_service.update_player_team() to update player rosters
- Work with Transaction model objects instead of raw API dictionaries
- Added player_service import
This follows the established pattern of using service layer methods
for all API interactions, improving code consistency and maintainability.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Add /admin-process-transactions command that allows admins to manually
process all transactions for the current week (or a specified week).
This serves as a fallback mechanism if the Monday morning automated
task fails to run transactions.
Features:
- Processes all non-frozen, non-cancelled transactions for a week
- Optional week parameter (defaults to current week)
- Real-time progress updates every 5 transactions
- Detailed success/failure reporting with error details
- Uses same API logic as the automated Monday task
- Includes rate limiting (100ms delay between transactions)
- Comprehensive logging for audit trail
The command is restricted to league administrators via @league_admin_only
decorator and uses @logged_command for standardized logging.
Updated /admin-help to include the new command in the League Management
section.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Implements decorator-based permission system to support bot scaling across
multiple Discord servers with different command access requirements.
Key Features:
- @global_command() - Available in all servers
- @league_only() - Restricted to league server only
- @requires_team() - Requires user to have a league team
- @admin_only() - Requires server admin permissions
- @league_admin_only() - Requires admin in league server
Implementation:
- utils/permissions.py - Core permission decorators and validation
- utils/permissions_examples.py - Comprehensive usage examples
- Automatic caching via TeamService.get_team_by_owner() (30-min TTL)
- User-friendly error messages for permission failures
Applied decorators to:
- League commands (league, standings, schedule, team, roster)
- Admin commands (management, league management, users)
- Draft system commands
- Transaction commands (dropadd, ilmove, management)
- Injury management
- Help system
- Custom commands
- Voice channels
- Gameplay (scorebug)
- Utilities (weather)
Benefits:
- Maximum flexibility - easy to change command scopes
- Built-in caching - ~80% reduction in API calls
- Combinable decorators for complex permissions
- Clean migration path for existing commands
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>