diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 886f90865..9a7c50235 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -742,7 +742,6 @@ class BotBase(GroupMixin): except CommandError as e: yield from ctx.command.dispatch_error(ctx, e) else: - ctx.command_failed = False self.dispatch('command_completion', ctx) elif ctx.invoked_with: exc = CommandNotFound('Command "{}" is not found'.format(ctx.invoked_with)) diff --git a/discord/ext/commands/context.py b/discord/ext/commands/context.py index 2d5ec2dae..ef7d9ca68 100644 --- a/discord/ext/commands/context.py +++ b/discord/ext/commands/context.py @@ -83,7 +83,7 @@ class Context(discord.abc.Messageable): self.invoked_with = attrs.pop('invoked_with', None) self.invoked_subcommand = attrs.pop('invoked_subcommand', None) self.subcommand_passed = attrs.pop('subcommand_passed', None) - self.command_failed = attrs.pop('command_failed', True) + self.command_failed = attrs.pop('command_failed', False) self._state = self.message._state @asyncio.coroutine diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 67a5e9f5c..29a0433c1 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -61,10 +61,13 @@ def hooked_wrapped_callback(command, ctx, coro): try: ret = yield from coro(*args, **kwargs) except CommandError: + ctx.command_failed = True raise except asyncio.CancelledError: + ctx.command_failed = True return except Exception as e: + ctx.command_failed = True raise CommandInvokeError(e) from e finally: yield from command.call_after_hooks(ctx) @@ -165,6 +168,7 @@ class Command: @asyncio.coroutine def dispatch_error(self, ctx, error): + ctx.command_failed = True cog = self.instance try: coro = self.on_error