Browse Source

[commands] Make Command.can_run process disabled commands

pull/2504/head
Rapptz 5 years ago
parent
commit
527b3485dc
  1. 14
      discord/ext/commands/core.py

14
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

Loading…
Cancel
Save