diff options
| author | 2020-08-22 19:43:15 -0700 | |
|---|---|---|
| committer | 2020-08-22 20:07:03 -0700 | |
| commit | 027ce8c5525187296a9f7bd26b89af9c66200835 (patch) | |
| tree | a10146063f53965c4176dc1f49e03e929d3aeb5f | |
| parent | Patch d.py decorators to support root aliases (diff) | |
Bot: fix AttributeError for commands which lack root_aliases
Even if the `command` decorators are patched, there are still some other
internal things that need to be patched. For example, the default help
command subclasses the original `Command` type. It's more maintainable
to exclude root alias support for these objects than to try to patch
everything.
Diffstat (limited to '')
| -rw-r--r-- | bot/bot.py | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/bot/bot.py b/bot/bot.py index 34254d8e8..d25074fd9 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -262,7 +262,7 @@ class Bot(commands.Bot):              for subcommand in command.commands:                  self._add_root_aliases(subcommand) -        for alias in command.root_aliases: +        for alias in getattr(command, "root_aliases", ()):              if alias in self.all_commands:                  raise commands.CommandRegistrationError(alias, alias_conflict=True) @@ -274,5 +274,5 @@ class Bot(commands.Bot):              for subcommand in command.commands:                  self._remove_root_aliases(subcommand) -        for alias in command.root_aliases: +        for alias in getattr(command, "root_aliases", ()):              self.all_commands.pop(alias, None) | 
