diff options
| author | Rapptz <[email protected]> | 2016-01-10 20:08:13 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2016-01-10 20:08:13 -0500 |
| commit | a706c47f3460bd3ccd8b02fb6fa1a6db466fba03 (patch) | |
| tree | cc4c97b0681a860fe4544a6dbf5d4a6197d3110d | |
| parent | Fix Client.remove_roles to actually remove roles. (diff) | |
| download | discord.py-a706c47f3460bd3ccd8b02fb6fa1a6db466fba03.tar.xz discord.py-a706c47f3460bd3ccd8b02fb6fa1a6db466fba03.zip | |
[commands] Remove all aliases if the main command is being deleted.
| -rw-r--r-- | discord/ext/commands/core.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index c00e08f0..8503dcaf 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -375,7 +375,15 @@ class GroupMixin: The command that was removed. If the name is not valid then `None` is returned instead. """ - return self.commands.pop(name, None) + command = self.commands.pop(name, None) + if name in command.aliases: + # we're removing an alias so we don't want to remove the rest + return command + + # we're not removing the alias so let's delete the rest of them. + for alias in command.aliases: + self.commands.pop(alias, None) + return command def get_command(self, name): """Get a :class:`Command` or subclasses from the internal list |