major-domo-v2/commands/draft/board.py
Cal Corum 4cb64253c4 CLAUDE: Add complete draft command suite
Implement all remaining draft commands for comprehensive draft management:

New Commands:
- /draft-admin (Group) - Admin controls for draft management
  * info - View current draft configuration
  * timer - Enable/disable draft timer
  * set-pick - Set current pick number
  * channels - Configure Discord channels
  * reset-deadline - Reset pick deadline

- /draft-status - View current draft state
- /draft-on-clock - Detailed "on the clock" information with recent/upcoming picks

- /draft-list - View team's auto-draft queue
- /draft-list-add - Add player to queue
- /draft-list-remove - Remove player from queue
- /draft-list-clear - Clear entire queue

- /draft-board - View draft picks by round

New Files:
- commands/draft/admin.py - Admin commands (app_commands.Group pattern)
- commands/draft/status.py - Status viewing commands
- commands/draft/list.py - Auto-draft queue management
- commands/draft/board.py - Draft board viewing

Features:
- Admin-only permissions for draft management
- FA player autocomplete for draft list
- Complete draft state visibility
- Round-by-round draft board viewing
- Lock status integration
- Timer and deadline management

Updated:
- commands/draft/__init__.py - Register all new cogs and group

All commands use @logged_command decorator for consistent logging and error handling.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 22:25:30 -05:00

80 lines
2.3 KiB
Python

"""
Draft Board Commands
View draft picks by round with pagination.
"""
from typing import Optional
import discord
from discord.ext import commands
from config import get_config
from services.draft_pick_service import draft_pick_service
from utils.logging import get_contextual_logger
from utils.decorators import logged_command
from views.draft_views import create_draft_board_embed
from views.embeds import EmbedTemplate
class DraftBoardCommands(commands.Cog):
"""Draft board viewing command handlers."""
def __init__(self, bot: commands.Bot):
self.bot = bot
self.logger = get_contextual_logger(f'{__name__}.DraftBoardCommands')
@discord.app_commands.command(
name="draft-board",
description="View draft picks by round"
)
@discord.app_commands.describe(
round_number="Round number to view (1-32)"
)
@logged_command("/draft-board")
async def draft_board(
self,
interaction: discord.Interaction,
round_number: Optional[int] = None
):
"""Display draft board for a specific round."""
await interaction.response.defer()
config = get_config()
# Default to round 1 if not specified
if round_number is None:
round_number = 1
# Validate round number
if round_number < 1 or round_number > config.draft_rounds:
embed = EmbedTemplate.error(
"Invalid Round",
f"Round number must be between 1 and {config.draft_rounds}."
)
await interaction.followup.send(embed=embed, ephemeral=True)
return
# Get picks for this round
picks = await draft_pick_service.get_picks_by_round(
config.sba_current_season,
round_number,
include_taken=True
)
if not picks:
embed = EmbedTemplate.error(
"No Picks Found",
f"Could not retrieve picks for round {round_number}."
)
await interaction.followup.send(embed=embed, ephemeral=True)
return
# Create draft board embed
embed = await create_draft_board_embed(round_number, picks)
await interaction.followup.send(embed=embed)
async def setup(bot: commands.Bot):
"""Load the draft board commands cog."""
await bot.add_cog(DraftBoardCommands(bot))