From fb76f1edb38818c5e0e835cd71930751a3878661 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Tue, 13 Jan 2026 16:25:38 -0600 Subject: [PATCH] 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 --- VERSION | 2 +- commands/profile/__init__.py | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 7079d89..10c20bb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.25.8 +2.25.9 diff --git a/commands/profile/__init__.py b/commands/profile/__init__.py index 8c90d24..10fa016 100644 --- a/commands/profile/__init__.py +++ b/commands/profile/__init__.py @@ -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