From 527b3485dc6e86de98c43da6ccf9bfd0a0fabd31 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 6 Jan 2020 00:16:34 -0500 Subject: [PATCH] [commands] Make Command.can_run process disabled commands --- discord/ext/commands/core.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 8c086603c..20930408b 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -657,13 +657,6 @@ class Command(_BaseCommand): if not view.eof: raise TooManyArguments('Too many arguments passed to ' + self.qualified_name) - async def _verify_checks(self, ctx): - if not self.enabled: - raise DisabledCommand('{0.name} command is disabled'.format(self)) - - if not await self.can_run(ctx): - raise CheckFailure('The check functions for command {0.qualified_name} failed.'.format(self)) - async def call_before_hooks(self, ctx): # now that we're done preparing we can call the pre-command hooks # first, call the command local hook: @@ -713,7 +706,9 @@ class Command(_BaseCommand): async def prepare(self, ctx): ctx.command = self - await self._verify_checks(ctx) + + if not await self.can_run(ctx): + raise CheckFailure('The check functions for command {0.qualified_name} failed.'.format(self)) if self.cooldown_after_parsing: await self._parse_arguments(ctx) @@ -950,6 +945,9 @@ class Command(_BaseCommand): A boolean indicating if the command can be invoked. """ + if not self.enabled: + raise DisabledCommand('{0.name} command is disabled'.format(self)) + original = ctx.command ctx.command = self