[commands] Make GroupMixin.remove_command return None.
This is for cases where the command has been removed already. This will make the function have a somewhat no exception guarantee.
This commit is contained in:
parent
0eccd85711
commit
a2b053a517
@ -486,6 +486,11 @@ class GroupMixin:
|
|||||||
`None` is returned instead.
|
`None` is returned instead.
|
||||||
"""
|
"""
|
||||||
command = self.commands.pop(name, None)
|
command = self.commands.pop(name, None)
|
||||||
|
|
||||||
|
# does not exist
|
||||||
|
if command is None:
|
||||||
|
return None
|
||||||
|
|
||||||
if name in command.aliases:
|
if name in command.aliases:
|
||||||
# we're removing an alias so we don't want to remove the rest
|
# we're removing an alias so we don't want to remove the rest
|
||||||
return command
|
return command
|
||||||
|
Loading…
x
Reference in New Issue
Block a user