mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 02:41:06 -05:00
fix: Improve cog loading order - Load main cog first - Wait for initialization - Load commands after successful init
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user