Skip to content

Commit

Permalink
[commands] Respect enabled kwarg for hybrid app commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Soheab authored Nov 7, 2024
1 parent af75985 commit c7305b0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion discord/ext/commands/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from discord import app_commands
from discord.utils import MISSING, maybe_coroutine, async_all
from .core import Command, Group
from .errors import BadArgument, CommandRegistrationError, CommandError, HybridCommandError, ConversionError
from .errors import BadArgument, CommandRegistrationError, CommandError, HybridCommandError, ConversionError, DisabledCommand
from .converter import Converter, Range, Greedy, run_converters, CONVERTER_MAPPING
from .parameters import Parameter
from .flags import is_flag, FlagConverter
Expand Down Expand Up @@ -526,6 +526,9 @@ def cog(self, value: CogT) -> None:
self.app_command.binding = value

async def can_run(self, ctx: Context[BotT], /) -> bool:
if not self.enabled:
raise DisabledCommand(f'{self.name} command is disabled')

if ctx.interaction is not None and self.app_command:

This comment has been minimized.

Copy link
@TootDevRoblox

TootDevRoblox Nov 7, 2024

HELP MEEEEEE

This comment has been minimized.

Copy link
@TootDevRoblox

TootDevRoblox Nov 7, 2024

MY DISCORD PY BOT IS ERROORRRRRRRRR File "D:\Scripts\HeavenBotFolder\bot.py", line 1, in
import discord
ModuleNotFoundError: No module named 'discord'

BUT I HAVE DISCORD

return await self.app_command._check_can_run(ctx.interaction)
else:
Expand Down

0 comments on commit c7305b0

Please sign in to comment.