Skip to content

Application Command Model

Note

The following classes come from the scurrypy.models.command module.


ApplicationCommandModel dataclass

Bases: DataModel

Represents the application command object.

id: int instance-attribute

Unique ID of command.

type: Optional[int] instance-attribute

Type of command. Defaults to ApplicationCommandTypes.CHAT_INPUT. See ApplicationCommandTypes.

application_id: int instance-attribute

ID of the parent application.

guild_id: Optional[int] instance-attribute

Guild ID of the command, if not global.

name: str instance-attribute

Name of the command.

description: str instance-attribute

Description for CHAT_INPUT commands.

Note

Empty for USER and MESSAGE commands.

options: Optional[list[ApplicationCommandOptionModel]] instance-attribute

Parameters for the command.

default_member_permissions: int instance-attribute

Set of permissions represented as a bit set. See Permissions. [INT_LIMIT]

nsfw: Optional[bool] instance-attribute

Whether the command is age-restricted. Defaults to False.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss


ApplicationCommandTypes

CHAT_INPUT = 1 class-attribute instance-attribute

Slash commands; a text-based command that shows up when a user types /.

USER = 2 class-attribute instance-attribute

A UI-based command that shows up when you right click or tap on a user.

MESSAGE = 3 class-attribute instance-attribute

A UI-based command that shows up when you right click or tap on a message.

PRIMARY_ENTRY_POINT = 4 class-attribute instance-attribute

A UI-based command that represents the primary way to invoke an app's Activity.


ApplicationCommandOptionModel dataclass

Bases: DataModel

Represents the application command option object.

type: int instance-attribute

Type of command option. See ApplicationCommandOptionTypes.

name: str instance-attribute

Name of the command option.

descripton: str instance-attribute

Description for the command option.

required: Optional[bool] instance-attribute

Whether this option is required. Defaults to False.

choices: Optional[list[ApplicationCommandOptionChoiceModel]] instance-attribute

Choices for the user to pick from.

channel_types: Optional[list[int]] instance-attribute

Channels shown will be restricted to these types.

min_value: Optional[int] instance-attribute

Minimum value allowed.

max_value: Optional[int] instance-attribute

Maximum value allowed.

min_length: Optional[int] instance-attribute

Minimum length allowed.

max_length: Optional[int] instance-attribute

Maximum length allowed.

autocomplete: Optional[bool] instance-attribute

Whether autocomplete interactions are enabled for this option.

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss


ApplicationCommandOptionTypes

STRING = 3 class-attribute instance-attribute

string (text)

INTEGER = 4 class-attribute instance-attribute

integer (Any integer between -2^53+1 and 2^53-1)

BOOLEAN = 5 class-attribute instance-attribute

boolean (true/false)

USER = 6 class-attribute instance-attribute

user pangination

CHANNEL = 7 class-attribute instance-attribute

channel pangination (category and channels)

ROLE = 8 class-attribute instance-attribute

role pangination

MENTIONABLE = 9 class-attribute instance-attribute

any pangination (role and user)

NUMBER = 10 class-attribute instance-attribute

number (Any double between -2^53 and 2^53)

ATTACHMENT = 11 class-attribute instance-attribute

file upload (See AttachmentPart)


ApplicationCommandOptionChoiceModel dataclass

Bases: DataModel

Represents the application command option choice object.

name: str instance-attribute

Name of the choice.

value: str instance-attribute

Value for the choice.

Note

Convert based on expected type (str, int or double)

to_dict

Recursively turns the dataclass into a dictionary and drops empty fields.

Returns:

  • dict

    serialized dataclasss