aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/ext/commands/bot.py1
-rw-r--r--discord/ext/commands/context.py2
-rw-r--r--discord/ext/commands/core.py4
3 files changed, 5 insertions, 2 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py
index 886f9086..9a7c5023 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 2d5ec2da..ef7d9ca6 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 67a5e9f5..29a0433c 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