Skip to content

Commit c7305b0

Browse files
authored
[commands] Respect enabled kwarg for hybrid app commands
1 parent af75985 commit c7305b0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

discord/ext/commands/hybrid.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from discord import app_commands
4444
from discord.utils import MISSING, maybe_coroutine, async_all
4545
from .core import Command, Group
46-
from .errors import BadArgument, CommandRegistrationError, CommandError, HybridCommandError, ConversionError
46+
from .errors import BadArgument, CommandRegistrationError, CommandError, HybridCommandError, ConversionError, DisabledCommand
4747
from .converter import Converter, Range, Greedy, run_converters, CONVERTER_MAPPING
4848
from .parameters import Parameter
4949
from .flags import is_flag, FlagConverter
@@ -526,6 +526,9 @@ def cog(self, value: CogT) -> None:
526526
self.app_command.binding = value
527527

528528
async def can_run(self, ctx: Context[BotT], /) -> bool:
529+
if not self.enabled:
530+
raise DisabledCommand(f'{self.name} command is disabled')
531+
529532
if ctx.interaction is not None and self.app_command:
530533
return await self.app_command._check_can_run(ctx.interaction)
531534
else:

0 commit comments

Comments
 (0)