major-domo-v2/commands/admin/__init__.py
Cal Corum 7b41520054 CLAUDE: Major bot enhancements - Admin commands, player stats, standings, schedules
Major Features Added:
• Admin Management System: Complete admin command suite with user moderation, system control, and bot maintenance tools
• Enhanced Player Commands: Added batting/pitching statistics with concurrent API calls and improved embed design
• League Standings: Full standings system with division grouping, playoff picture, and wild card visualization
• Game Schedules: Comprehensive schedule system with team filtering, series organization, and proper home/away indicators

New Admin Commands (12 total):
• /admin-status, /admin-help, /admin-reload, /admin-sync, /admin-clear
• /admin-announce, /admin-maintenance
• /admin-timeout, /admin-untimeout, /admin-kick, /admin-ban, /admin-unban, /admin-userinfo

Enhanced Player Display:
• Team logo positioned beside player name using embed author
• Smart thumbnail priority: fancycard → headshot → team logo fallback
• Concurrent batting/pitching stats fetching for performance
• Rich statistics display with team colors and comprehensive metrics

New Models & Services:
• BattingStats, PitchingStats, TeamStandings, Division, Game models
• StatsService, StandingsService, ScheduleService for data management
• CustomCommand system with CRUD operations and cleanup tasks

Bot Architecture Improvements:
• Admin commands integrated into bot.py with proper loading
• Permission checks and safety guards for moderation commands
• Enhanced error handling and comprehensive audit logging
• All 227 tests passing with new functionality

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-28 15:32:38 -05:00

52 lines
1.5 KiB
Python

"""
Admin command package for Discord Bot v2.0
Contains administrative commands for league management.
"""
import logging
from typing import List, Tuple, Type
import discord
from discord.ext import commands
from .management import AdminCommands
from .users import UserManagementCommands
logger = logging.getLogger(f'{__name__}.setup_admin')
async def setup_admin(bot: commands.Bot) -> Tuple[int, int, List[str]]:
"""
Set up admin command modules.
Returns:
Tuple of (successful_loads, failed_loads, failed_modules)
"""
admin_cogs: List[Tuple[str, Type[commands.Cog]]] = [
("AdminCommands", AdminCommands),
("UserManagementCommands", UserManagementCommands),
]
successful = 0
failed = 0
failed_modules = []
for cog_name, cog_class in admin_cogs:
try:
await bot.add_cog(cog_class(bot))
logger.info(f"✅ Loaded admin command module: {cog_name}")
successful += 1
except Exception as e:
logger.error(f"❌ Failed to load admin command module {cog_name}: {e}")
failed += 1
failed_modules.append(cog_name)
# Log summary
if failed == 0:
logger.info(f"🎉 All {successful} admin command modules loaded successfully")
else:
logger.warning(f"⚠️ Admin commands loaded with issues: {successful} successful, {failed} failed")
if failed_modules:
logger.warning(f"Failed modules: {', '.join(failed_modules)}")
return successful, failed, failed_modules