- New !loaded <d6> <2d6> <d20> [user_id] command for predetermined dice - Loaded values consumed on next /ab roll (one-shot) - Supports targeting other users by ID for testing - Admin-restricted prefix commands (!loaded, !unload, !checkload) - Self-contained in commands/dev/ package Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
"""
|
|
Dev Commands Package
|
|
|
|
Developer-only commands for testing. Hidden from regular users.
|
|
"""
|
|
import logging
|
|
from discord.ext import commands
|
|
|
|
from .loaded_dice import LoadedDiceCommands
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
async def setup_dev(bot: commands.Bot) -> tuple[int, int, list[str]]:
|
|
"""
|
|
Setup all dev command modules.
|
|
|
|
Returns:
|
|
tuple: (successful_count, failed_count, failed_modules)
|
|
"""
|
|
dev_cogs = [
|
|
("LoadedDiceCommands", LoadedDiceCommands),
|
|
]
|
|
|
|
successful = 0
|
|
failed = 0
|
|
failed_modules = []
|
|
|
|
for cog_name, cog_class in dev_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)
|
|
|
|
if failed == 0:
|
|
logger.info(f"🎉 All {successful} dev command modules loaded successfully")
|
|
else:
|
|
logger.warning(f"⚠️ Dev commands loaded with issues: {successful} successful, {failed} failed")
|
|
|
|
return successful, failed, failed_modules
|
|
|
|
|
|
__all__ = ['setup_dev', 'LoadedDiceCommands']
|