AznStevy / Maybe-Useful-Cogs

Random cogs for a discord bot.
MIT License
29 stars 31 forks source link

[Leveler] cog will not load anymore #55

Open GSecurity opened 6 years ago

GSecurity commented 6 years ago

Hi, Since some time (didn't see exactly when it was happening first, but from the logs, looks like it first had this issue 10/09/2017), I can't load the Leveler cog and have the following error: [07/03/2018 21:01] ERROR red load_cogs 573: Command role is already registered. Traceback (most recent call last): File "red.py", line 570, in load_cogs owner_cog._load_cog(extension) File "/home/gsecurity/Red-DiscordBot/cogs/owner.py", line 948, in _load_cog self.bot.load_extension(mod_obj.__name__) File "lib/discord/ext/commands/bot.py", line 738, in load_extension lib.setup(self) File "/home/gsecurity/Red-DiscordBot/cogs/leveler.py", line 3286, in setup bot.add_cog(n) File "lib/discord/ext/commands/bot.py", line 655, in add_cog self.add_command(member) File "lib/discord/ext/commands/core.py", line 487, in add_command raise discord.ClientException('Command {0.name} is already registered.'.format(command)) discord.errors.ClientException: Command role is already registered. I really have no idea what is causing this. If I force load the cog with the !load command, I will get this error: [07/03/2018 20:52] ERROR owner load 74: Command role is already registered. Traceback (most recent call last): File "/home/gsecurity/Red-DiscordBot/cogs/owner.py", line 65, in load self._load_cog(module) File "/home/gsecurity/Red-DiscordBot/cogs/owner.py", line 948, in _load_cog self.bot.load_extension(mod_obj.__name__) File "lib/discord/ext/commands/bot.py", line 738, in load_extension lib.setup(self) File "/home/gsecurity/Red-DiscordBot/cogs/leveler.py", line 3286, in setup bot.add_cog(n) File "lib/discord/ext/commands/bot.py", line 655, in add_cog self.add_command(member) File "lib/discord/ext/commands/core.py", line 487, in add_command raise discord.ClientException('Command {0.name} is already registered.'.format(command)) discord.errors.ClientException: Command role is already registered. and the cog is deactivated by the boat for loading next time. But, at this stage, manually loading the cog with !load will give the above error, but afterwards seems to work.

Any idea ?

(Red is up-to-date so is leveler). Thank you. Regards.

calebj commented 6 years ago

When you get this error, what is the output of [p]debug bot.commands['role'].module ?

GSecurity commented 6 years ago

Here's the output: <module 'cogs.customroles' from '/home/gsecurity/Red-DiscordBot/cogs/customroles.py'> I guess it's related to this cog?: https://cogs.red/cogs/PaddoInWonderland/PaddoCogs/customroles/ But don't see why it would interfere if it's that :/

calebj commented 6 years ago

It interferes because leveler also has a command named role, which is too generic imo because of the possibility of this exact thing. Best to rename it in the code for now to something like lvrole.

GSecurity commented 6 years ago

Ok, thank you, gonna try to change this. Hope you'll fix this in a next version too like you said to something less "generic" :D [Edit] Proposed fix worked just fine ;) Thanks again.

Catacalys commented 5 years ago

Close this thread :thinking: