Pincer Objects App#

Applications#

Application#

class Application#

Bases: APIObject, GuildProperty

Represents a Discord application. (e.g. Bot, OAuth)

bot_public#

when false only app owner can join the app’s bot to guilds

Type

bool

bot_require_code_grant#

when true the app’s bot will only join upon completion of the full oauth2 code grant flow

Type

bool

description#

the description of the app

Type

str

id#

the id of the app

Type

Snowflake

icon#

the icon hash of the app

Type

Optional[str]

name#

the name of the app

Type

str

privacy_policy_url#

the url of the app’s privacy policy

Type

APINullable[str]

summary#

if this application is a game sold on Discord, this field will be the summary field for the store page of its primary sku

Type

str

verify_key#

the hex encoded key for verification in interactions and the GameSDK’s GetTicket

Type

str

cover_image#

the application’s default rich presence invite cover image hash

Type

APINullable[str]

flags#

the application’s public flags’

Type

APINullable[int]

guild_id#

if this application is a game sold on Discord, this field will be the guild to which it has been linked

Type

APINullable[Snowflake]

owner#

partial user object containing info on the owner of the application

Type

APINullable[User]

primary_sku_id#

if this application is a game sold on Discord, this field will be the id of the “Game SKU” that is created, if exists

Type

APINullable[Snowflake]

rpc_origins#

an array of rpc origin urls, if rpc is enabled

Type

APINullable[List[str]]

slug#

if this application is a game sold on Discord, this field will be the URL slug that links to the store page

Type

APINullable[str]

terms_of_service_url#

the url of the app’s terms of service

Type

APINullable[str]

Commands#

AppCommandType#

Attributes
class AppCommandType#

Bases: IntEnum

Defines the different types of application commands.

CHAT_INPUT#

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

USER#

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

MESSAGE#

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

AppCommandOptionType#

class AppCommandOptionType#

Bases: IntEnum

Represents a parameter type.

SUB_COMMAND#

The parameter will be a subcommand.

SUB_COMMAND_GROUP#

The parameter will be a group of subcommands.

STRING#

The parameter will be a string.

INTEGER#

The parameter will be an integer/number. (-2^53 and 2^53)

BOOLEAN#

The parameter will be a boolean.

USER#

The parameter will be a Discord user object.

CHANNEL#

The parameter will be a Discord channel object.

ROLE#

The parameter will be a Discord role object.

MENTIONABLE#

The parameter will be mentionable.

NUMBER#

The parameter will be a float. (-2^53 and 2^53)

AppCommandInteractionDataOption#

Attributes
class AppCommandInteractionDataOption#

Bases: APIObject

Represents a Discord Application Command Interaction Data Option

name#

The name of the parameter

Type

str

value#

The value of the pair

Type

str

type#

Value of application command option type

Type

APINullable[str]

options#

Present if this option is a group or subcommand

Type

APINullable[List[AppCommandInteractionDataOption]]

AppCommandOption#

class AppCommandOption#

Bases: APIObject

Represents a Discord Application Command Option object

type#

The type of option

Type

AppCommandOptionType

name#

1-32 lowercase character name matching ^[w-]{1,32}$

Type

str

description#

1-100 character description

Type

str

required#

If the parameter is required or optional

Default: False

Type

APINullable[bool]

choices#

Choices for STRING, INTEGER, and NUMBER types for the user to pick from, max 25

Type

APINullable[List[AppCommandOptionChoice]]

options#

If the option is a subcommand or subcommand group type, this nested options will be the parameters

Type

APINullable[List[AppCommandOptionChoice]]

AppCommand#

class AppCommand#

Bases: APIObject, GuildProperty

Represents a Discord Application Command object

type#

The type of command, defaults 1 if not set

Type

AppCommandType

name#

1-32 character name

Type

str

description#

1-100 character description for CHAT_INPUT commands, empty string for USER and MESSAGE commands

Type

str

id#

Unique id of the command

Type

APINullable[Snowflake]

version#

Auto-incrementing version identifier updated during substantial record changes

Type

APINullable[Snowflake]

application_id#

Unique id of the parent application

Type

APINullable[Snowflake]

options#

The parameters for the command, max 25

Type

APINullable[List[AppCommandOption]]

guild_id#

Guild id of the command, if not global

Type

APINullable[Snowflake]

default_permission#

Whether the command is enabled by default when the app is added to a guild

Type

APINullable[bool]

add_option(option)#

Add a new option field to the current application command.

Parameters

option (AppCommandOption) – The option which will be appended.

InteractableStructure#

class InteractableStructure#

Bases: Generic[T]

Represents the structure of how the client saves the existing commands to registers. This is generic over Application Commands, Message Components, and Autocomplete.

call#

The coroutine which should be called when the command gets executed.

Type

Coro

metadata#

The metadata for this command.

Default: None

Type

T

manager#

The manager for this interactable.

Default: None

Type

Optional[Any]

extensions#

List of extensions for this command.

Default: []

Type

List[Callable[…, Awaitable[bool]]]

cooldown#

Amount of times for cooldown

Default: 0

Type

int

cooldown_scale#

Search time for cooldown

Default: 60.0

Type

float

cooldown_scope#

The type of cooldown

Intents#

Intents#

class Intents#

Bases: IntFlag

Discord client intents.

These give your client more permissions.

Note

The given Intents must also be enabled for your client on the discord dashboard.

NONE#

No intents.

GUILDS#

Guilds intent.

GUILD_MEMBERS#

Members intent.

GUILD_BANS#

Bans intent.

GUILD_EMOJIS_AND_STICKERS#

Emoji and Sticker intent.

GUILD_INTEGRATIONS#

Integrations intent.

GUILD_WEBHOOKS#

Webhooks intent.

GUILD_INVITES#

Invites intent.

GUILD_VOICE_STATES#

Voice states intent.

GUILD_PRESENCES#

Presences intent.

GUILD_MESSAGES#

Message intent.

GUILD_MESSAGE_REACTIONS#

Reactions to messages intent.

GUILD_MESSAGE_TYPING#

Typing to message intent.

DIRECT_MESSAGES#

DM messages intent.

DIRECT_MESSAGE_REACTIONS#

DM reaction to messages intent.

DIRECT_MESSAGE_TYPING#

DM typing to message intent.

classmethod all()#

Intents: Method of all intents

Interaction Base#

CallbackType#

class CallbackType#

Bases: IntEnum

The types of response a client can give to an interaction.

PONG#

ACK a Ping

MESSAGE#

Respond to an interaction with a message

DEFERRED_MESSAGE#

ACK an interaction and edit a response later, the user sees a loading state

DEFERRED_UPDATE_MESSAGE#

For components, ACK an interaction and edit the original message later

UPDATE_MESSAGE#

For components, edit the message the component was attached to

MODAL#

Reply to that interaction with a modal

InteractionType#

class InteractionType#

Bases: IntEnum

Represents the different types of interactions the client can have with a member.

PING#

Ping an interaction.

APPLICATION_COMMAND#

A “slash” command.

MESSAGE_COMPONENT#

A UI component like buttons and selects.

AUTOCOMPLETE#

Autocomplete for interaction options.

MODAL#

Emitter when a modal gets submitted.

MessageInteraction#

class InteractionFlags#

Bases: IntFlag

EPHEMERAL#

Only the user receiving the message can see it.

SUPPRESS_EMBEDS#

No link embeds should be shown for this message.

ResolvedData#

class ResolvedData#

Bases: APIObject

Represents a Discord Resolved Data structure

users#

Map of Snowflakes to user objects

Type

APINullable[Dict[Snowflake, User]]

members#

Map of Snowflakes to partial member objects

Type

APINullable[Dict[Snowflake, GuildMember]]

roles#

Map of Snowflakes to role objects

Type

APINullable[Dict[Snowflake, Role]]

channels#

Map of Snowflakes to partial channel objects

Type

APINullable[Dict[Snowflake, Channel]]

messages#

Map of Snowflakes to partial message objects

Type

APINullable[Dict[Snowflake, UserMessage]]

InteractionData#

class InteractionData#

Bases: APIObject

Represents a Discord Interaction Data structure

id#

The ID of the invoked command

Type

Snowflake

name#

The name of the invoked command

Type

str

type#

The type of the invoked command

Type

int

resolved#

Converted users + roles + channels

Type

APINullable[ResolvedData]

options#

The params + values from the user

Type

APINullable[AppCommandInteractionDataOption]

custom_id#

The custom_id of the component

Type

APINullable[str]

component_type#

The type of the component

Type

APINullable[int]

values#

The values the user selected

Type

APINullable[SelectOption]

target_id#

Id of the user or message targeted by a user or message command

Type

APINullable[Snowflake]

Interaction#

class Interaction#

Bases: APIObject, ChannelProperty, GuildProperty

Represents a Discord Interaction object

id#

Id of the interaction

Type

Snowflake

application_id#

Id of the application this interaction is for

Type

Snowflake

type#

The type of interaction

Type

InteractionType

token#

A continuation token for responding to the interaction

Type

str

version#

Read-only property, always 1

Type

int

data#

The command data payload

Type

APINullable[InteractionData]

guild_id#

The guild it was sent from

Type

APINullable[Snowflake]

channel_id#

The channel it was sent from

Type

APINullable[Snowflake]

member#

Guild member data for the invoking user, including permissions

Type

APINullable[GuildMember]

user#

User object for the invoking user, if invoked in a DM

Type

APINullable[User]

message#

For components, the message they were attached to

Type

APINullable[UserMessage]

await ack(flags=None)#

This function is a coroutine.

Acknowledge an interaction, any flags here are applied to the reply.

:param flags InteractionFlags: The flags which must be applied to the reply.

Default: None

await deferred_update_ack(flags=None)#

This function is a coroutine. Same as ack but for updating a message.

:param flags InteractionFlags: The flags which must be applied to the reply.

Default: None

await delete()#

This function is a coroutine.

Delete the interaction.

Raises

InteractionDoesNotExist – Exception raised when no reply has been sent.

await delete_followup(message)#

This function is a coroutine.

Remove a followup message by id.

:param message Union[UserMessage: The id/followup object of the followup message that must be deleted. :param int]: The id/followup object of the followup message that must be deleted.

await edit(message)#

This function is a coroutine.

Edit an interaction. This is also the way to reply to interactions whom have been acknowledged.

:param message MessageConvertable: The new message!

Returns

The updated message object.

Return type

UserMessage

Raises

InteractionDoesNotExist – Exception raised when no reply has been sent.

await edit_followup(message_id, message)#

This function is a coroutine.

Edit a followup message.

:param message_id int: The id of the original followup message. :param message MessageConvertable: The message new message.

Returns

The updated message object.

Return type

UserMessage

await followup(message)#

This function is a coroutine.

Create a follow-up message for the interaction. This allows you to respond with multiple messages.

:param message MessageConvertable: The message to send.

Returns

The message that has been sent.

Return type

UserMessage

await get_followup(message_id)#

This function is a coroutine.

Get a followup message by id.

:param message_id int: The id of the original followup message that must be fetched.

Returns

The fetched message object.

Return type

UserMessage

await reply(message)#

This function is a coroutine. Sends a reply to an interaction.

await response()#

This function is a coroutine.

Gets the original response for an interaction.

Returns

The fetched response!

Return type

UserMessage

staticmethod return_type(option, data)#

Returns a value from the option or None if it doesn’t exist.

optionSnowflake

Snowflake to search data for.

dataDict[Snowflake, Any]

Resolved data to search through.

await update(message)#

This function is a coroutine. Edits the reply to an interaction. Only works with Message Component Interactions.

Session Start Limit#

SessionStartLimit#

class SessionStartLimit#

Bases: APIObject

Represents a Discord Session Start Limit

total#

The total number of session starts the current user is allowed

Type

int

remaining#

The remaining number of session starts the current user is allowed

Type

int

reset_after#

The number of milliseconds after which the limit resets

Type

int

max_concurrency#

The number of identify requests allowed per 5 seconds

Type

int

Throttle Scope#

ThrottleScope#

Attributes
class ThrottleScope#

Bases: Enum

On what the cooldown should be set/on what should the cooldown be set.

GUILD#

The cooldown is per guild.

CHANNEL#

The cooldown is per channel.

USER#

The cooldown is per user.

GLOBAL#

The cooldown is global.

Throttling#

ThrottleInterface#

class ThrottleInterface#

Bases: ABC

An ABC for throttling.

DefaultThrottleHandler#

Methods
class DefaultThrottleHandler#

Bases: ThrottleInterface, ABC

The default throttle-handler based off the ThrottleInterface ABC

staticmethod get_key_from_scope(command)#

Retrieve the appropriate key from the context through the throttle scope.

Parameters

ctx (MessageContext) – The context to retrieve with

Returns

The throttle-scope enum

Return type

Optional[int]

Mentionable#

Attributes
class Mentionable#

Bases: object

Represents the Mentionable type

userOptional[User]

User object returned from a discord interaction

role: Optional[Role]

Role object returned from a discord interaction

property is_role#

Returns true if the Mentionable object has a Role

property is_user#

Returns true if the Mentionable object has a User