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:
|
async def setup(bot: Red) -> None:
|
||||||
"""Load VideoArchiver."""
|
"""Load VideoArchiver."""
|
||||||
|
# Load main cog first
|
||||||
cog = VideoArchiver(bot)
|
cog = VideoArchiver(bot)
|
||||||
await bot.add_cog(cog)
|
await bot.add_cog(cog)
|
||||||
|
|
||||||
async def teardown(bot: Red) -> None:
|
# Wait for initialization to complete
|
||||||
"""Clean up when unloading."""
|
await cog.ready.wait()
|
||||||
# Let Red handle command cleanup
|
|
||||||
pass
|
# 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