Fix profile commands package not returning expected tuple
The setup_profile_commands() function was returning None instead of the expected (successful, failed, failed_modules) tuple, causing bot startup to log "Failed to load profile package: cannot unpack non-iterable NoneType". Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ee434c98f1
commit
fb76f1edb3
@ -3,10 +3,38 @@ Profile management commands package.
|
||||
|
||||
Handles user-facing profile management including player image updates.
|
||||
"""
|
||||
import logging
|
||||
|
||||
from discord.ext import commands
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def setup_profile_commands(bot: commands.Bot):
|
||||
"""Load profile management commands."""
|
||||
"""
|
||||
Load profile management commands.
|
||||
|
||||
Returns:
|
||||
tuple: (successful_count, failed_count, failed_modules)
|
||||
"""
|
||||
from commands.profile.images import ImageCommands
|
||||
await bot.add_cog(ImageCommands(bot))
|
||||
|
||||
successful = 0
|
||||
failed = 0
|
||||
failed_modules = []
|
||||
|
||||
try:
|
||||
await bot.add_cog(ImageCommands(bot))
|
||||
logger.info("✅ Loaded ImageCommands")
|
||||
successful += 1
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Failed to load ImageCommands: {e}", exc_info=True)
|
||||
failed += 1
|
||||
failed_modules.append("ImageCommands")
|
||||
|
||||
if failed == 0:
|
||||
logger.info(f"🎉 All {successful} profile command modules loaded successfully")
|
||||
else:
|
||||
logger.warning(f"⚠️ Profile commands loaded with issues: {successful} successful, {failed} failed")
|
||||
|
||||
return successful, failed, failed_modules
|
||||
|
||||
Loading…
Reference in New Issue
Block a user