discord-interactions.py

SlashCommand

Classe

Commande déclarée. Créée par @slash.command().

from discord_interactions import SlashCommand

Constructeur

SlashCommand(    name: str,    description: str,    callback: Callable[..., Awaitable[Any]],    options: List[OptionBase] = <factory>,    name_localizations: Dict[str, str] | None = None,    description_localizations: Dict[str, str] | None = None,    permissions: PermissionConfig = <factory>,    cooldowns: List[CooldownBucket] = <factory>,    guild_ids: Set[int] | None = None,    parent: str | None = None,    group: str | None = None,    auto_defer: bool = False,    defer_ephemeral: bool = False,    ephemeral_by_default: bool = False,    _enabled: bool = True,)
NomTypeDéfautDescription
namestrrequis
descriptionstrrequis
callbackCallable[..., Awaitable[Any]]requis
optionsList[OptionBase]<factory>
name_localizationsDict[str, str] | NoneNone
description_localizationsDict[str, str] | NoneNone
permissionsPermissionConfig<factory>
cooldownsList[CooldownBucket]<factory>
guild_idsSet[int] | NoneNone
parentstr | NoneNone
groupstr | NoneNone
auto_deferboolFalse
defer_ephemeralboolFalse
ephemeral_by_defaultboolFalse
_enabledboolTrue

Propriétés

NomTypeDescription
namestr
descriptionstr
callbackCallable[..., Awaitable[Any]]
optionsList[OptionBase]
name_localizationsDict[str, str] | None
description_localizationsDict[str, str] | None
permissionsPermissionConfig
cooldownsList[CooldownBucket]
guild_idsSet[int] | None
parentstr | None
groupstr | None
auto_deferbool
defer_ephemeralbool
ephemeral_by_defaultbool

Méthodes

to_dict

def to_dict() -> Dict[str, Any]

to_subcommand_dict

def to_subcommand_dict() -> Dict[str, Any]

prepare

def prepare(values: Dict[str, Any]) -> Dict[str, Any]

Applique défauts et transformations, filtre selon la signature du callback.

invoke

async def invoke(ctx: SlashContext, **kwargs: Any) -> Any

Tape un nom : create_button, ModalBuilder, cooldown.