From 7ba50c91a2a6c74ad87d40d0c04e587dfe817492 Mon Sep 17 00:00:00 2001 From: DevilXD Date: Thu, 18 Jul 2019 11:49:40 +0200 Subject: [PATCH] Fixed remove_command error when trying to remove a non-existent command (#2889) * Fixed remove_command error when trying to remove a non-existent command * Added changelog entry --- changelog.d/2888.bugfix.rst | 1 + redbot/core/bot.py | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 changelog.d/2888.bugfix.rst diff --git a/changelog.d/2888.bugfix.rst b/changelog.d/2888.bugfix.rst new file mode 100644 index 000000000..19f76701d --- /dev/null +++ b/changelog.d/2888.bugfix.rst @@ -0,0 +1 @@ +Fixed remove_command error when trying to remove a non-existent command \ No newline at end of file diff --git a/redbot/core/bot.py b/redbot/core/bot.py index ceeb05ff0..9d047aed0 100644 --- a/redbot/core/bot.py +++ b/redbot/core/bot.py @@ -461,6 +461,8 @@ class RedBase(commands.GroupMixin, commands.bot.BotBase, RPCMixin): # pylint: d def remove_command(self, name: str) -> None: command = super().remove_command(name) + if not command: + return command.requires.reset() if isinstance(command, commands.Group): for subcommand in set(command.walk_commands()):