From 24a9da04db730313204d959d77602192ec742a3b Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 4 Jun 2016 21:41:01 -0400 Subject: [PATCH] [commands] Cleanup Command.invoke code due to exception propagation. --- discord/ext/commands/core.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 65967bdf6..b5509530e 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -352,7 +352,6 @@ class Command: args.append(transformed) except RuntimeError: break - return True def _verify_checks(self, ctx): if not self.enabled: @@ -363,16 +362,13 @@ class Command: if not self.can_run(ctx): raise CheckFailure('The check functions for command {0.name} failed.'.format(self)) - return True @asyncio.coroutine def invoke(self, ctx): - if not self._verify_checks(ctx): - return - - if (yield from self._parse_arguments(ctx)): - injected = inject_context(ctx, self.callback) - yield from injected(*ctx.args, **ctx.kwargs) + self._verify_checks(ctx) + yield from self._parse_arguments(ctx) + injected = inject_context(ctx, self.callback) + yield from injected(*ctx.args, **ctx.kwargs) def error(self, coro): """A decorator that registers a coroutine as a local error handler. @@ -587,9 +583,8 @@ class Group(GroupMixin, Command): def invoke(self, ctx): early_invoke = not self.invoke_without_command if early_invoke: - valid = self._verify_checks(ctx) and (yield from self._parse_arguments(ctx)) - if not valid: - return + self._verify_checks(ctx) + yield from self._parse_arguments(ctx) view = ctx.view previous = view.index @@ -612,9 +607,8 @@ class Group(GroupMixin, Command): # undo the trigger parsing view.index = previous view.previous = previous - valid = self._verify_checks(ctx) and (yield from self._parse_arguments(ctx)) - if not valid: - return + self._verify_checks(ctx) + yield from self._parse_arguments(ctx) injected = inject_context(ctx, self.callback) yield from injected(*ctx.args, **ctx.kwargs)