fix: Resolve command registration issues - Separate command handling into VideoArchiverCommands - Update command registration in __init__.py - Remove duplicate command registration

This commit is contained in:
pacnpal
2024-11-15 00:50:55 +00:00
parent a760bef25d
commit 4e632276c2
2 changed files with 5 additions and 13 deletions

View File

@@ -2,7 +2,7 @@
from __future__ import annotations
import discord
from redbot.core import commands, Config, data_manager, app_commands
from redbot.core import commands, Config, data_manager
from pathlib import Path
import logging
import asyncio
@@ -123,10 +123,6 @@ class VideoArchiver(commands.Cog):
# Wait for initialization to complete
await asyncio.wait_for(self.ready.wait(), timeout=30)
# Add commands to the bot
for command in self.commands_handler.videoarchiver.commands:
self.bot.tree.add_command(command)
except asyncio.TimeoutError:
await self._cleanup()
raise ProcessingError("Cog initialization timed out")
@@ -136,10 +132,6 @@ class VideoArchiver(commands.Cog):
async def cog_unload(self) -> None:
"""Clean up when cog is unloaded"""
# Remove commands from the bot
for command in self.commands_handler.videoarchiver.commands:
self.bot.tree.remove_command(command.name)
await self._cleanup()
async def _cleanup(self) -> None: