-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[commands] Respect enabled kwarg for hybrid app commands
- Loading branch information
Showing
1 changed file
with
4 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
TootDevRoblox
|
||
return await self.app_command._check_can_run(ctx.interaction) | ||
else: | ||
|
HELP MEEEEEE