Skip to content

Commit

Permalink
[commands] Remove all aliases if the main command is being deleted.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapptz committed Jan 11, 2016
1 parent 2c31c46 commit a706c47
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion discord/ext/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,15 @@ def remove_command(self, name):
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
Expand Down

0 comments on commit a706c47

Please sign in to comment.