SlashCommand
Class
A declared command. Created by @slash.command().
from discord_interactions import SlashCommandConstructor
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,)| Name | Type | Default | Description |
|---|---|---|---|
name | str | required | |
description | str | required | |
callback | Callable[..., Awaitable[Any]] | required | |
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 |
Properties
| Name | Type | Description |
|---|---|---|
name | str | |
description | str | |
callback | Callable[..., Awaitable[Any]] | |
options | List[OptionBase] | |
name_localizations | Dict[str, str] | None | |
description_localizations | Dict[str, str] | None | |
permissions | PermissionConfig | |
cooldowns | List[CooldownBucket] | |
guild_ids | Set[int] | None | |
parent | str | None | |
group | str | None | |
auto_defer | bool | |
defer_ephemeral | bool | |
ephemeral_by_default | bool |
Methods
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]invoke
async def invoke(ctx: SlashContext, **kwargs: Any) -> Any