diff options
| author | Rapptz <[email protected]> | 2017-06-12 17:44:05 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-06-12 17:44:05 -0400 |
| commit | 7d6435fa9c3b66000b2a19ae847d07c2aa1d85c9 (patch) | |
| tree | 5a01b9c4b0178942cc24414bd7ebba9c9a771705 | |
| parent | Fix format string in documentation. (diff) | |
| download | discord.py-7d6435fa9c3b66000b2a19ae847d07c2aa1d85c9.tar.xz discord.py-7d6435fa9c3b66000b2a19ae847d07c2aa1d85c9.zip | |
[commands] Don't display default error handler if a cog local exists.
| -rw-r--r-- | discord/ext/commands/bot.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index dc4aa21e..0f7d8a76 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -201,10 +201,16 @@ class BotBase(GroupMixin): if self.extra_events.get('on_command_error', None): return - if hasattr(context.command, "on_error"): + if hasattr(context.command, 'on_error'): return - print('Ignoring exception in command {}'.format(context.command), file=sys.stderr) + cog = context.cog + if cog: + attr = '__{0.__class__.__name__}_error'.format(cog) + if hasattr(cog, attr): + return + + print('Ignoring exception in command {}:'.format(context.command), file=sys.stderr) traceback.print_exception(type(exception), exception, exception.__traceback__, file=sys.stderr) # global check registration |