From 888ed27d17a99fcbd94abe50f6eb02cde20e9b8a Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Fri, 15 Nov 2024 01:03:53 +0000 Subject: [PATCH] fix: Improve cog loading order - Load main cog first - Wait for initialization - Load commands after successful init --- videoarchiver/__init__.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/videoarchiver/__init__.py b/videoarchiver/__init__.py index db6fd9f..e6be5a0 100644 --- a/videoarchiver/__init__.py +++ b/videoarchiver/__init__.py @@ -4,10 +4,20 @@ from .video_archiver import VideoArchiver async def setup(bot: Red) -> None: """Load VideoArchiver.""" + # Load main cog first cog = VideoArchiver(bot) await bot.add_cog(cog) - -async def teardown(bot: Red) -> None: - """Clean up when unloading.""" - # Let Red handle command cleanup - pass + + # Wait for initialization to complete + await cog.ready.wait() + + # Only load commands if main cog initialized successfully + if cog.ready.is_set(): + from .commands import VideoArchiverCommands + commands_cog = VideoArchiverCommands( + bot, + cog.config_manager, + cog.update_checker, + cog.processor + ) + await bot.add_cog(commands_cog)