Pincer Objects App#
Applications#
Application#
- class Application#
Bases:
APIObject
,GuildProperty
Represents a Discord application. (e.g. Bot, OAuth)
- bot_require_code_grant#
when true the app’s bot will only join upon completion of the full oauth2 code grant flow
- Type
- 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
- verify_key#
the hex encoded key for verification in interactions and the GameSDK’s GetTicket
- Type
- 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
]
- 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
]
Commands#
AppCommandType#
- 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#
- class AppCommandInteractionDataOption#
Bases:
APIObject
Represents a Discord Application Command Interaction Data Option
- 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
- required#
If the parameter is required or optional
Default:False
- Type
APINullable[
bool
]
- choices#
Choices for
STRING
,INTEGER
, andNUMBER
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#
AttributesMethods- defadd_option
- class AppCommand#
Bases:
APIObject
,GuildProperty
Represents a Discord Application Command object
- type#
The type of command, defaults
1
if not set- Type
AppCommandType
- description#
1-100 character description for
CHAT_INPUT
commands, empty string forUSER
andMESSAGE
commands- Type
- version#
Auto-incrementing version identifier updated during substantial record changes
- Type
APINullable[
Snowflake
]
- options#
The parameters for the command, max 25
- Type
APINullable[List[
AppCommandOption
]]
- 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#
Attributes- 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
- cooldown_scale#
Search time for cooldown
Default:60.0
- Type
- cooldown_scope#
The type of cooldown
Default:ThrottleScope.USER
- Type
Intents#
Intents#
AttributesMethods- clsIntents.all
- 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.
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#
Attributes- 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#
ResolvedData#
- class ResolvedData#
Bases:
APIObject
Represents a Discord Resolved Data structure
- members#
Map of Snowflakes to partial member objects
- Type
APINullable[Dict[
Snowflake
,GuildMember
]]
- messages#
Map of Snowflakes to partial message objects
- Type
APINullable[Dict[
Snowflake
,UserMessage
]]
InteractionData#
- class InteractionData#
Bases:
APIObject
Represents a Discord Interaction Data structure
- resolved#
Converted users + roles + channels
- Type
APINullable[
ResolvedData
]
- options#
The params + values from the user
- Type
APINullable[
AppCommandInteractionDataOption
]
- values#
The values the user selected
- Type
APINullable[
SelectOption
]
Interaction#
Methods- asyncack
- asyncdeferred_update_ack
- asyncdelete
- asyncdelete_followup
- asyncedit
- asyncedit_followup
- asyncfollowup
- asyncget_followup
- asyncreply
- asyncresponse
- defreturn_type
- asyncupdate
- class Interaction#
Bases:
APIObject
,ChannelProperty
,GuildProperty
Represents a Discord Interaction object
- type#
The type of interaction
- Type
- data#
The command data payload
- Type
APINullable[
InteractionData
]
- member#
Guild member data for the invoking user, including permissions
- Type
APINullable[
GuildMember
]
- 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. :paramint
]: 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
- 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 messageMessageConvertable
: The message new message.- Returns
The updated message object.
- Return type
- 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
- 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
- await response()#
This function is a coroutine.
Gets the original response for an interaction.
- Returns
The fetched response!
- Return type
- staticmethod return_type(option, data)#
Returns a value from the option or None if it doesn’t exist.
- option
Snowflake
Snowflake to search
data
for.- dataDict[
Snowflake
, Any] Resolved data to search through.
- option
- await update(message)#
This function is a coroutine. Edits the reply to an interaction. Only works with Message Component Interactions.
Session Start Limit#
SessionStartLimit#
AttributesThrottle Scope#
ThrottleScope#
Throttling#
ThrottleInterface#
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#
- 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
- userOptional[