Application Command Components¶
Module which contains different discord application command components.
- from_dict()[source]¶
Populate the Dataclass from a dictionary.
- Parameters
data (Dict) – The dictionary to populate the dataclass from.
cls (Any) –
- Returns
The Dataclass instance.
- Return type
Any
- class AppCommand[source]¶
The model equivalent to a generic discord Application Command.
- type: int = 0¶
The type of the command.
- id: str = None¶
Unique id of the command
- application_id: str = None¶
Unique id of the application to which the command belongs.
- guild_id: str = None¶
Guild id of the command, if not global
- name: str = None¶
Command name, must be between 1 and 32 characters.
Warning
The cmd_ prefix must be removed before assigning.
- description: str = ''¶
A description with a length between 1 and 100 characters.
- options: List[CommandOptions]¶
The parameters for the command, max 25
- classmethod types()[source]¶
Return the command types of parent and children commands.
- Returns
The command types of parent and children commands.
- Return type
Set[int]
- class SlashCommand[source]¶
The model equivalent to a discord Slash Command. Has the structure of command input object from discord’s api.
- type: int = 1¶
- The type of the command.Always 1 because this is a slash command.
- property parameters: Dict[str, Tuple[int, bool]]¶
The parameters of the command.
- Returns
The function parameters, along with type and required.
- Return type
- class ContextMenu[source]¶
The model equivalent to a discord Context Menu.
Note
This is intended to be only used for simple
NormalCommands
. There’s no scope of args and kwargs here.- type: int = 2¶
- The type of the command.
- callback: Callable = None¶
A callback which gets executed upon interaction.
- registered: Dict[str, ContextMenu]¶
Holder for all the created context menu commands.
- async execute()[source]¶
Executes the registered callback.
- Parameters
interaction (
discord.Interaction
) – The interaction which triggered the callback.
- class UserCommand[source]¶
The model equivalent to a discord Context Menu.
- type: int = 2¶
- The type of the command.Always 2 because this is a user command.
- class MessageCommand[source]¶
The model equivalent to a discord Message Command.
- type: int = 3¶
- The type of the command.Always 3 because this is a message command.
- class IsoTimeStamp[source]¶
A class which represents an ISO 8601 timestamp.
- parse()[source]¶
Parses the timestamp and returns a datetime object.
- Returns
The parsed datetime object.
- Return type
datetime
- class GuildEvent[source]¶
The model equivalent to a discord Guild Scheduled Event.
- id: str = None¶
Unique id of the event
- guild_id: str = None¶
Id of the guild to which the event belongs.
- channel_id: str = None¶
Id of the channel to which the event belongs.
- name: str = None¶
The name of the event. .. note:
Must be between 1 and 100 characters.
- description: str = ''¶
The description of the event. .. note:
Must be between 1 and 1000 characters.
- scheduled_start_time: IsoTimeStamp = None¶
The time at which the event will start.
- scheduled_end_time: IsoTimeStamp = None¶
The time at which the event will end.
- privacy_level: int = 2¶
The privacy level of the scheduled event
- status: int = 1¶
The status of the event.
- entity_type: int = 3¶
The type of the scheduled event.
- entity_id: str = None¶
The id of the entity to which the event belongs.
- entity_metadata: Dict¶
The metadata for the event entity.
- creator: Dict¶
The event creator object.
- user_count: int = 0¶
Number of users who have subscribed to the event.
- classmethod from_dict()[source]¶
Creates a GuildEvent object from a dictionary.
- Parameters
data (Dict) – The dictionary to create the object from.
- Returns
The created GuildEvent object.
- Return type
- to_payload()[source]¶
Converts the event to a payload.
- Returns
The event as a payload.
- Return type
Dict