mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
[commands] Document GroupCog.interaction_check
This commit is contained in:
parent
1e9d04bbca
commit
a5a93a85bc
@ -50,6 +50,7 @@ from ._types import _BaseCommand, BotT
|
||||
if TYPE_CHECKING:
|
||||
from typing_extensions import Self
|
||||
from discord.abc import Snowflake
|
||||
from discord._types import ClientT
|
||||
|
||||
from .bot import BotBase
|
||||
from .context import Context
|
||||
@ -585,6 +586,18 @@ class Cog(metaclass=CogMeta):
|
||||
"""
|
||||
return True
|
||||
|
||||
@_cog_special_method
|
||||
def interaction_check(self, interaction: discord.Interaction[ClientT], /) -> bool:
|
||||
"""A special method that registers as a :func:`discord.app_commands.check`
|
||||
for every app command and subcommand in this cog.
|
||||
|
||||
This function **can** be a coroutine and must take a sole parameter,
|
||||
``interaction``, to represent the :class:`~discord.Interaction`.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
"""
|
||||
return True
|
||||
|
||||
@_cog_special_method
|
||||
async def cog_command_error(self, ctx: Context[BotT], error: Exception) -> None:
|
||||
"""|coro|
|
||||
|
@ -256,7 +256,7 @@ GroupCog
|
||||
.. attributetable:: discord.ext.commands.GroupCog
|
||||
|
||||
.. autoclass:: discord.ext.commands.GroupCog
|
||||
:members:
|
||||
:members: interaction_check
|
||||
|
||||
|
||||
CogMeta
|
||||
|
Loading…
x
Reference in New Issue
Block a user