From 1c553f51fb3fa1b6c713d6b17e38e0b1798e434b Mon Sep 17 00:00:00 2001 From: pikaninja <38714028+pikaninja@users.noreply.github.com> Date: Wed, 7 Apr 2021 20:42:52 -0700 Subject: [PATCH] [commands] Use has_error_handler instead in command_error --- discord/ext/commands/bot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index e421f8d98..59f11c74f 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -167,11 +167,12 @@ class BotBase(GroupMixin): if self.extra_events.get('on_command_error', None): return - if hasattr(context.command, 'on_error'): + command = context.command + if command and command.has_error_handler(): return cog = context.cog - if cog and Cog._get_overridden_method(cog.cog_command_error) is not None: + if cog and cog.has_error_handler(): return print(f'Ignoring exception in command {context.command}:', file=sys.stderr)