CLAUDE: Integrate draft commands into bot.py

Add draft command package to bot startup sequence:
- Create setup_draft() function in commands/draft/__init__.py
- Follow standard package pattern with resilient loading
- Import and register in bot.py command packages list

Changes:
- commands/draft/__init__.py: Add setup function and cog exports
- bot.py: Import setup_draft and add to command_packages

The /draft command will now load automatically when the bot starts.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2025-10-24 22:17:09 -05:00
parent ea7b356db9
commit 4dd9b21322
2 changed files with 50 additions and 3 deletions

2
bot.py
View File

@ -115,6 +115,7 @@ class SBABot(commands.Bot):
from commands.admin import setup_admin
from commands.transactions import setup_transactions
from commands.dice import setup_dice
from commands.draft import setup_draft
from commands.voice import setup_voice
from commands.utilities import setup_utilities
from commands.help import setup_help_commands
@ -133,6 +134,7 @@ class SBABot(commands.Bot):
("admin", setup_admin),
("transactions", setup_transactions),
("dice", setup_dice),
("draft", setup_draft),
("voice", setup_voice),
("utilities", setup_utilities),
("help", setup_help_commands),

View File

@ -3,6 +3,51 @@ Draft Commands Package for Discord Bot v2.0
Contains slash commands for draft operations:
- /draft - Make a draft pick with autocomplete
- /draft-status - View current draft state
- /draft-admin - Admin controls for draft management
- /draft-status - View current draft state (TODO)
- /draft-admin - Admin controls for draft management (TODO)
"""
import logging
from discord.ext import commands
from .picks import DraftPicksCog
logger = logging.getLogger(__name__)
async def setup_draft(bot: commands.Bot):
"""
Setup all draft command modules.
Returns:
tuple: (successful_count, failed_count, failed_modules)
"""
# Define all draft command cogs to load
draft_cogs = [
("DraftPicksCog", DraftPicksCog),
]
successful = 0
failed = 0
failed_modules = []
for cog_name, cog_class in draft_cogs:
try:
await bot.add_cog(cog_class(bot))
logger.info(f"✅ Loaded {cog_name}")
successful += 1
except Exception as e:
logger.error(f"❌ Failed to load {cog_name}: {e}", exc_info=True)
failed += 1
failed_modules.append(cog_name)
# Log summary
if failed == 0:
logger.info(f"🎉 All {successful} draft command modules loaded successfully")
else:
logger.warning(f"⚠️ Draft commands loaded with issues: {successful} successful, {failed} failed")
return successful, failed, failed_modules
# Export the setup function for easy importing
__all__ = ['setup_draft', 'DraftPicksCog']