diff options
| author | Rapptz <[email protected]> | 2020-01-06 00:16:34 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-01-06 00:30:04 -0500 |
| commit | 527b3485dc6e86de98c43da6ccf9bfd0a0fabd31 (patch) | |
| tree | 1c770c0fd53f2151141658438ee33fda8b362dcf | |
| parent | Add `VoiceRegion.dubai` (diff) | |
| download | discord.py-527b3485dc6e86de98c43da6ccf9bfd0a0fabd31.tar.xz discord.py-527b3485dc6e86de98c43da6ccf9bfd0a0fabd31.zip | |
[commands] Make Command.can_run process disabled commands
| -rw-r--r-- | discord/ext/commands/core.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 8c086603..20930408 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 |