aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-06-30 15:15:49 -0400
committerRapptz <[email protected]>2016-06-30 15:15:49 -0400
commita2b053a517fe52597bc84b91a7359fb20042b1da (patch)
treebcb22e6225371a2f7736fce6fa33cb7d0325dc5f
parentAdd implicit cases to permission resolution in Channel.permissions_for (diff)
downloaddiscord.py-a2b053a517fe52597bc84b91a7359fb20042b1da.tar.xz
discord.py-a2b053a517fe52597bc84b91a7359fb20042b1da.zip
[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.
-rw-r--r--discord/ext/commands/core.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py
index 9308e9ce..9abee04e 100644
--- a/discord/ext/commands/core.py
+++ b/discord/ext/commands/core.py
@@ -486,6 +486,11 @@ class GroupMixin:
`None` is returned instead.
"""
command = self.commands.pop(name, None)
+
+ # does not exist
+ if command is None:
+ return None
+
if name in command.aliases:
# we're removing an alias so we don't want to remove the rest
return command