mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-04 17:20:09 +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:
|
if TYPE_CHECKING:
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
from discord.abc import Snowflake
|
from discord.abc import Snowflake
|
||||||
|
from discord._types import ClientT
|
||||||
|
|
||||||
from .bot import BotBase
|
from .bot import BotBase
|
||||||
from .context import Context
|
from .context import Context
|
||||||
@ -585,6 +586,18 @@ class Cog(metaclass=CogMeta):
|
|||||||
"""
|
"""
|
||||||
return True
|
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
|
@_cog_special_method
|
||||||
async def cog_command_error(self, ctx: Context[BotT], error: Exception) -> None:
|
async def cog_command_error(self, ctx: Context[BotT], error: Exception) -> None:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
@ -256,7 +256,7 @@ GroupCog
|
|||||||
.. attributetable:: discord.ext.commands.GroupCog
|
.. attributetable:: discord.ext.commands.GroupCog
|
||||||
|
|
||||||
.. autoclass:: discord.ext.commands.GroupCog
|
.. autoclass:: discord.ext.commands.GroupCog
|
||||||
:members:
|
:members: interaction_check
|
||||||
|
|
||||||
|
|
||||||
CogMeta
|
CogMeta
|
||||||
|
Loading…
x
Reference in New Issue
Block a user