H3xadecimal / Notus

The corpse of a mistake we're desperately trying to fix for years. Unfortunately unable to transmute into something better as learnt from the Elric brothers.
3 stars 2 forks source link

Bugs with CommandGroups #16

Closed Ovyerus closed 6 years ago

Ovyerus commented 6 years ago

CommandGroups don't get added into the CommandHolder.modules[module_name] list. Sometimes, a module will fail to load due to the following error, which appears to be caused by a CommandGroup.

Traceback (most recent call last):
  File "/home/rslsync/OvyBot/amethyst.py", line 232, in on_message
    await self.holder.run_command(ctx)
  File "/home/rslsync/OvyBot/utils/command_system.py", line 522, in run_command
    await cmd.run(ctx)
  File "/home/rslsync/OvyBot/utils/command_system.py", line 187, in run
    await self.func(self.cls, ctx, *args, **kwargs)
  File "/home/rslsync/OvyBot/modules/core.py", line 65, in module
    self.amethyst.holder.load_module(module_name)
  File "/home/rslsync/OvyBot/utils/command_system.py", line 481, in load_module
    self.aliases[alias] = self.commands[cmd.name]
KeyError: 'nickname'
Martmists-GH commented 6 years ago

Why did we decide to move away from ext.commands again?

H3xadecimal commented 6 years ago

Convenience purposes, also cause Ovy wanted to.

Ovyerus commented 6 years ago

Allows us to extend on it without too much hasse, and learning™

Martmists-GH commented 6 years ago

You can easily override the command class, which makes extending far easier. you could do something like

def command(*args, **kwargs):
    return discord.ext.commands.command(*args, cls=MyCommand, **kwargs)
Ovyerus commented 6 years ago

¯\_(ツ)_/¯

Ovyerus commented 6 years ago

Seems to be fixed.

Ovyerus commented 6 years ago

Key error bug still happening

H3xadecimal commented 6 years ago

Further testing required to replicate this error on my end, Will also look into it.

H3xadecimal commented 6 years ago

Error successfully replicated, not sure if that's a good thing. Entering debugging phase.

Ovyerus commented 6 years ago

Latest commit hopefully fixed this.

Ovyerus commented 6 years ago

k nvm its not, but it seems to be happening less often.