Hi, is it possible to unload/reload a cog with BridgeCommand? Whenever I try to unload the extension, it raises "AttributeError: 'BridgeCommand' object has no attribute 'name'".
Expected: unloads/reloads the targeted cog
Result: Raises an error
Traceback
Traceback (most recent call last):
File "/root/bot/cogs/admin.py", line 86, in unload
self.bot.unload_extension(cog)
File "/usr/local/lib/python3.10/dist-packages/discord/cog.py", line 1066, in unload_extension
self._remove_module_references(lib.__name__)
File "/usr/local/lib/python3.10/dist-packages/discord/cog.py", line 722, in _remove_module_references
self.remove_cog(cog_name)
File "/usr/local/lib/python3.10/dist-packages/discord/cog.py", line 706, in remove_cog
cog._eject(self)
File "/usr/local/lib/python3.10/dist-packages/discord/cog.py", line 592, in _eject
bot.remove_command(command.name)
AttributeError: 'BridgeCommand' object has no attribute 'name'```
Code
```py
@commands.command(name='reload', aliases=['rl'])
async def reload(self, ctx, cog):
extensions = self.bot.extensions # A list of the bot's cogs/extensions.
cog = "cogs." + cog
if cog in extensions:
try:
# Using reload_extension does not work neither
self.bot.unload_extension(cog) # Unloads the cog
self.bot.load_extension(cog) # Loads the cog
print(f"\n=====\nCog {cog} reloaded\n=====")
await ctx.send(f"Cog {cog[5:]} reloaded") # Sends a message
except:
await ctx.send("Stacktrace", file=discord.File(io.BytesIO(traceback.format_exc().encode("utf-8")), f"error.txt"))
else:
await ctx.send('Unknown Cog: ' + cog[5:]) # If the cog isn't found/loaded.```
