Interactions¶
This section documents everything related to interactions, which are used for communication between user and client. Common examples are message components and application commands.
Discord Models¶
Interaction¶
- asyncdelete_original_message
- asyncdelete_original_response
- asyncedit_original_message
- asyncedit_original_response
- defis_expired
- asyncoriginal_message
- asyncoriginal_response
- asyncsend
- class disnake.Interaction[source]¶
- A base class representing a user-initiated Discord interaction. - An interaction happens when a user performs an action that the client needs to be notified of. Current examples are application commands and components. - New in version 2.0. - data¶
- The interaction’s raw data. This might be replaced with a more processed version in subclasses. 
 - type¶
- The interaction’s type. - Type:
 
 - guild_locale¶
- The selected language of the interaction’s guild. This value is only meaningful in guilds with - COMMUNITYfeature and receives a default value otherwise. If the interaction was in a DM, then this value is- None.- New in version 2.4. 
 - channel¶
- The channel the interaction was sent from. - Note that due to a Discord limitation, DM channels may not contain recipient information. Unknown channel types will be - PartialMessageable.- Changed in version 2.10: If the interaction was sent from a thread and the bot cannot normally access the thread, this is now a proper - Threadobject. Private channels are now proper- DMChannel/- GroupChannelobjects instead of- PartialMessageable.- Note - If you want to compute the interaction author’s or bot’s permissions in the channel, consider using - permissionsor- app_permissions.- Type:
- abc.GuildChannel|- Thread|- abc.PrivateChannel|- PartialMessageable
 
 - author¶
- The user or member that sent the interaction. - Note - In scenarios where an interaction occurs in a guild but - guildis unavailable, such as with user-installed applications in guilds, some attributes of- Members that depend on the guild/role cache will not work due to an API limitation. This includes- roles,- top_role,- role_icon, and- guild_permissions.
 - entitlements¶
- The entitlements for the invoking user and guild, representing access to an application subscription. - New in version 2.10. - Type:
 
 - authorizing_integration_owners¶
- Details about the authorizing user/guild for the application installation related to the interaction. - New in version 2.10. 
 - context¶
- The context where the interaction was triggered from. - This is a flag object, with exactly one of the flags set to - True. To check whether an interaction originated from e.g. a- guildcontext, you can use- if interaction.context.guild:.- New in version 2.10. - Type:
 
 - attachment_size_limit¶
- The maximum number of bytes files can have in responses to this interaction. - This may be higher than the default limit, depending on the guild’s boost status or the invoking user’s nitro status. - New in version 2.11. - Type:
 
 - original_message()[source]¶
- An alias of - original_response().
 - edit_original_message()[source]¶
- An alias of - edit_original_response().
 - delete_original_message()[source]¶
- An alias of - delete_original_response().
 - property user[source]¶
- The user or member that sent the interaction. There is an alias for this named - author.
 - property guild[source]¶
- The guild the interaction was sent from. - Note - In some scenarios, e.g. for user-installed applications, this will usually be - None, despite the interaction originating from a guild. This will only return a full- Guildfor cached guilds, i.e. those the bot is already a member of.- To check whether an interaction was sent from a guild, consider using - guild_idor- contextinstead.
 - me¶
- Similar to - Guild.me, except it may return the- ClientUserin private message contexts or when the bot is not a member of the guild (e.g. in the case of user-installed applications).- Type:
 
 - property permissions[source]¶
- The resolved permissions of the member in the channel, including overwrites. - In a guild context, this is provided directly by Discord. - In a non-guild context this will be an instance of - Permissions.private_channel().- Type:
 
 - property app_permissions[source]¶
- The resolved permissions of the bot in the channel, including overwrites. - New in version 2.6. - Changed in version 2.10: This is now always provided by Discord. - Type:
 
 - response¶
- Returns an object responsible for handling responding to the interaction. - A response can only be done once. If secondary messages need to be sent, consider using - followupinstead.- Type:
 
 - expires_at¶
- Returns the interaction’s expiration time in UTC. - This is exactly 15 minutes after the interaction was created. - New in version 2.5. - Type:
 
 - is_expired()[source]¶
- Whether the interaction can still be used to make requests to Discord. - This does not take into account the 3 second limit for the initial response. - New in version 2.5. - Return type:
 
 - await original_response()[source]¶
- This function is a coroutine. - Fetches the original interaction response message associated with the interaction. - Repeated calls to this will return a cached value. - Changed in version 2.6: This function was renamed from - original_message.- Raises:
- HTTPException – Fetching the original response message failed. 
- Returns:
- The original interaction response message. 
- Return type:
 
 - await edit_original_response(content=..., *, embed=..., embeds=..., file=..., files=..., attachments=..., view=..., components=..., poll=..., suppress_embeds=..., flags=..., allowed_mentions=None, delete_after=None)[source]¶
- This function is a coroutine. - Edits the original, previously sent interaction response message. - This is a lower level interface to - InteractionMessage.edit()in case you do not want to fetch the message and save an HTTP request.- This method is also the only way to edit the original response if the message sent was ephemeral. - Note - If the original response message has embeds with images that were created from local files (using the - fileparameter with- Embed.set_image()or- Embed.set_thumbnail()), those images will be removed if the message’s attachments are edited in any way (i.e. by setting- file/- files/- attachments, or adding an embed with local files).- Changed in version 2.6: This function was renamed from - edit_original_message.- Parameters:
- content ( - str|- None) – The content to edit the message with, or- Noneto clear it.
- embed ( - Embed|- None) – The new embed to replace the original with. This cannot be mixed with the- embedsparameter. Could be- Noneto remove the embed.
- embeds ( - list[- Embed]) – The new embeds to replace the original with. Must be a maximum of 10. This cannot be mixed with the- embedparameter. To remove all embeds- []should be passed.
- file ( - File) – The file to upload. This cannot be mixed with the- filesparameter. Files will be appended to the message, see the- attachmentsparameter to remove/replace existing files.
- files ( - list[- File]) – A list of files to upload. This cannot be mixed with the- fileparameter. Files will be appended to the message, see the- attachmentsparameter to remove/replace existing files.
- attachments ( - list[- Attachment] |- None) –- A list of attachments to keep in the message. If - []or- Noneis passed then all existing attachments are removed. Keeps existing attachments if not provided.- New in version 2.2. - Changed in version 2.5: Supports passing - Noneto clear attachments.
- view ( - View|- None) – The updated view to update this message with. This cannot be mixed with- components. If- Noneis passed then the view is removed.
- components ( - UIComponent|- list[- UIComponent|- list[- WrappedComponent]] |- None) –- A list of components to update this message with. This cannot be mixed with - view. If- Noneis passed then the components are removed.- New in version 2.4. - Note - Passing v2 components here automatically sets the - is_components_v2flag. Setting this flag cannot be reverted. Note that this also disables the- contentand- embedsfields. If the message previously had any of these fields set, you must set them to- None.
- poll ( - Poll) –- A poll. This can only be sent after a defer. If not used after a defer the discord API ignore the field. - New in version 2.10. 
- allowed_mentions ( - AllowedMentions) – Controls the mentions being processed in this message. See- abc.Messageable.send()for more information.
- suppress_embeds ( - bool) –- Whether to suppress embeds for the message. This hides all the embeds from the UI if set to - True. If set to- False, this brings the embeds back if they were suppressed.- New in version 2.7. 
- flags ( - MessageFlags) –- The new flags to set for this message. Overrides existing flags. Only - suppress_embedsand- is_components_v2are supported.- If parameter - suppress_embedsis provided, that will override the setting of- MessageFlags.suppress_embeds.- New in version 2.9. 
- If provided, the number of seconds to wait in the background before deleting the message we just edited. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - Interaction.expires_at/- is_expired).- New in version 2.10. 
 
- Raises:
- HTTPException – Editing the message failed. 
- Forbidden – Edited a message that is not yours. 
- TypeError – You specified both - embedand- embedsor- fileand- files.
- ValueError – The length of - embedswas invalid, or you tried to send v2 components together with- contentor- embeds.
 
- Returns:
- The newly edited message. 
- Return type:
 
 - await delete_original_response(*, delay=None)[source]¶
- This function is a coroutine. - Deletes the original interaction response message. - This is a lower level interface to - InteractionMessage.delete()in case you do not want to fetch the message and save an HTTP request.- Changed in version 2.6: This function was renamed from - delete_original_message.- Parameters:
- If provided, the number of seconds to wait in the background before deleting the original response message. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - Interaction.expires_at/- is_expired).
- Raises:
- HTTPException – Deleting the message failed. 
- Forbidden – Deleted a message that is not yours. 
 
 
 - await send(content=None, *, embed=..., embeds=..., file=..., files=..., allowed_mentions=..., view=..., components=..., tts=False, ephemeral=..., suppress_embeds=..., flags=..., delete_after=..., poll=...)[source]¶
- This function is a coroutine. - Sends a message using either - response.send_messageor- followup.send.- If the interaction hasn’t been responded to yet, this method will call - response.send_message. Otherwise, it will call- followup.send.- Note - This method does not return a - Messageobject. If you need a message object, use- original_response()to fetch it, or use- followup.senddirectly instead of this method if you’re sending a followup message.- Parameters:
- embed ( - Embed) – The rich embed for the content to send. This cannot be mixed with the- embedsparameter.
- embeds ( - list[- Embed]) – A list of embeds to send with the content. Must be a maximum of 10. This cannot be mixed with the- embedparameter.
- file ( - File) – The file to upload. This cannot be mixed with the- filesparameter.
- files ( - list[- File]) – A list of files to upload. Must be a maximum of 10. This cannot be mixed with the- fileparameter.
- allowed_mentions ( - AllowedMentions) – Controls the mentions being processed in this message. If this is passed, then the object is merged with- Client.allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in- Client.allowed_mentions. If no object is passed at all then the defaults given by- Client.allowed_mentionsare used instead.
- tts ( - bool) – Whether the message should be sent using text-to-speech.
- view ( - disnake.ui.View) – The view to send with the message. This cannot be mixed with- components.
- components ( - UIComponent|- list[- UIComponent|- list[- WrappedComponent]]) –- A list of components to send with the message. This cannot be mixed with - view.- New in version 2.4. - Note - Passing v2 components here automatically sets the - is_components_v2flag. Setting this flag cannot be reverted. Note that this also disables the- content,- embeds, and- pollfields.
- ephemeral ( - bool) – Whether the message should only be visible to the user who started the interaction. If a view is sent with an ephemeral message and it has no timeout set then the timeout is set to 15 minutes.
- suppress_embeds ( - bool) –- Whether to suppress embeds for the message. This hides all the embeds from the UI if set to - True.- New in version 2.5. 
- flags ( - MessageFlags) –- The flags to set for this message. Only - suppress_embeds,- ephemeral,- suppress_notifications, and- is_components_v2are supported.- If parameters - suppress_embedsor- ephemeralare provided, they will override the corresponding setting of this- flagsparameter.- New in version 2.9. 
- delete_after ( - float) –- If provided, the number of seconds to wait in the background before deleting the message we just sent. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - expires_at/- is_expired).- Changed in version 2.7: Added support for ephemeral responses. 
- poll ( - Poll) –- The poll to send with the message. - New in version 2.10. 
 
- Raises:
- HTTPException – Sending the message failed. 
- TypeError – You specified both - embedand- embeds.
- ValueError – The length of - embedswas invalid, or you tried to send v2 components together with- content,- embeds, or- poll.
 
 
 
ApplicationCommandInteraction¶
- app_permissions
- application_command
- application_id
- attachment_size_limit
- author
- authorizing_integration_owners
- bot
- channel
- channel_id
- client
- command_failed
- context
- created_at
- data
- entitlements
- expires_at
- filled_options
- followup
- guild
- guild_id
- guild_locale
- id
- locale
- me
- options
- permissions
- response
- target
- token
- type
- user
- asyncdelete_original_message
- asyncdelete_original_response
- asyncedit_original_message
- asyncedit_original_response
- defis_expired
- asyncoriginal_message
- asyncoriginal_response
- asyncsend
- class disnake.ApplicationCommandInteraction[source]¶
- Represents an interaction with an application command. - Current examples are slash commands, user commands and message commands. - New in version 2.1. - type¶
- The interaction’s type. - Type:
 
 - channel¶
- The channel the interaction was sent from. - Note that due to a Discord limitation, DM channels may not contain recipient information. Unknown channel types will be - PartialMessageable.- Changed in version 2.10: If the interaction was sent from a thread and the bot cannot normally access the thread, this is now a proper - Threadobject. Private channels are now proper- DMChannel/- GroupChannelobjects instead of- PartialMessageable.- Note - If you want to compute the interaction author’s or bot’s permissions in the channel, consider using - permissionsor- app_permissions.- Type:
- abc.GuildChannel|- Thread|- abc.PrivateChannel|- PartialMessageable
 
 - author¶
- The user or member that sent the interaction. - Note - In scenarios where an interaction occurs in a guild but - guildis unavailable, such as with user-installed applications in guilds, some attributes of- Members that depend on the guild/role cache will not work due to an API limitation. This includes- roles,- top_role,- role_icon, and- guild_permissions.
 - guild_locale¶
- The selected language of the interaction’s guild. This value is only meaningful in guilds with - COMMUNITYfeature and receives a default value otherwise. If the interaction was in a DM, then this value is- None.- New in version 2.4. 
 - entitlements¶
- The entitlements for the invoking user and guild, representing access to an application subscription. - New in version 2.10. - Type:
 
 - authorizing_integration_owners¶
- Details about the authorizing user/guild for the application installation related to the interaction. - New in version 2.10. 
 - context¶
- The context where the interaction was triggered from. - This is a flag object, with exactly one of the flags set to - True. To check whether an interaction originated from e.g. a- guildcontext, you can use- if interaction.context.guild:.- New in version 2.10. - Type:
 
 - attachment_size_limit¶
- The maximum number of bytes files can have in responses to this interaction. - This may be higher than the default limit, depending on the guild’s boost status or the invoking user’s nitro status. - New in version 2.11. - Type:
 
 - data¶
- The wrapped interaction data. 
 - application_command¶
- The command invoked by the interaction. 
 - original_message()[source]¶
- An alias of - original_response().
 - edit_original_message()[source]¶
- An alias of - edit_original_response().
 - delete_original_message()[source]¶
- An alias of - delete_original_response().
 - property app_permissions[source]¶
- The resolved permissions of the bot in the channel, including overwrites. - New in version 2.6. - Changed in version 2.10: This is now always provided by Discord. - Type:
 
 - await delete_original_response(*, delay=None)[source]¶
- This function is a coroutine. - Deletes the original interaction response message. - This is a lower level interface to - InteractionMessage.delete()in case you do not want to fetch the message and save an HTTP request.- Changed in version 2.6: This function was renamed from - delete_original_message.- Parameters:
- If provided, the number of seconds to wait in the background before deleting the original response message. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - Interaction.expires_at/- is_expired).
- Raises:
- HTTPException – Deleting the message failed. 
- Forbidden – Deleted a message that is not yours. 
 
 
 - await edit_original_response(content=..., *, embed=..., embeds=..., file=..., files=..., attachments=..., view=..., components=..., poll=..., suppress_embeds=..., flags=..., allowed_mentions=None, delete_after=None)[source]¶
- This function is a coroutine. - Edits the original, previously sent interaction response message. - This is a lower level interface to - InteractionMessage.edit()in case you do not want to fetch the message and save an HTTP request.- This method is also the only way to edit the original response if the message sent was ephemeral. - Note - If the original response message has embeds with images that were created from local files (using the - fileparameter with- Embed.set_image()or- Embed.set_thumbnail()), those images will be removed if the message’s attachments are edited in any way (i.e. by setting- file/- files/- attachments, or adding an embed with local files).- Changed in version 2.6: This function was renamed from - edit_original_message.- Parameters:
- content ( - str|- None) – The content to edit the message with, or- Noneto clear it.
- embed ( - Embed|- None) – The new embed to replace the original with. This cannot be mixed with the- embedsparameter. Could be- Noneto remove the embed.
- embeds ( - list[- Embed]) – The new embeds to replace the original with. Must be a maximum of 10. This cannot be mixed with the- embedparameter. To remove all embeds- []should be passed.
- file ( - File) – The file to upload. This cannot be mixed with the- filesparameter. Files will be appended to the message, see the- attachmentsparameter to remove/replace existing files.
- files ( - list[- File]) – A list of files to upload. This cannot be mixed with the- fileparameter. Files will be appended to the message, see the- attachmentsparameter to remove/replace existing files.
- attachments ( - list[- Attachment] |- None) –- A list of attachments to keep in the message. If - []or- Noneis passed then all existing attachments are removed. Keeps existing attachments if not provided.- New in version 2.2. - Changed in version 2.5: Supports passing - Noneto clear attachments.
- view ( - View|- None) – The updated view to update this message with. This cannot be mixed with- components. If- Noneis passed then the view is removed.
- components ( - UIComponent|- list[- UIComponent|- list[- WrappedComponent]] |- None) –- A list of components to update this message with. This cannot be mixed with - view. If- Noneis passed then the components are removed.- New in version 2.4. - Note - Passing v2 components here automatically sets the - is_components_v2flag. Setting this flag cannot be reverted. Note that this also disables the- contentand- embedsfields. If the message previously had any of these fields set, you must set them to- None.
- poll ( - Poll) –- A poll. This can only be sent after a defer. If not used after a defer the discord API ignore the field. - New in version 2.10. 
- allowed_mentions ( - AllowedMentions) – Controls the mentions being processed in this message. See- abc.Messageable.send()for more information.
- suppress_embeds ( - bool) –- Whether to suppress embeds for the message. This hides all the embeds from the UI if set to - True. If set to- False, this brings the embeds back if they were suppressed.- New in version 2.7. 
- flags ( - MessageFlags) –- The new flags to set for this message. Overrides existing flags. Only - suppress_embedsand- is_components_v2are supported.- If parameter - suppress_embedsis provided, that will override the setting of- MessageFlags.suppress_embeds.- New in version 2.9. 
- If provided, the number of seconds to wait in the background before deleting the message we just edited. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - Interaction.expires_at/- is_expired).- New in version 2.10. 
 
- Raises:
- HTTPException – Editing the message failed. 
- Forbidden – Edited a message that is not yours. 
- TypeError – You specified both - embedand- embedsor- fileand- files.
- ValueError – The length of - embedswas invalid, or you tried to send v2 components together with- contentor- embeds.
 
- Returns:
- The newly edited message. 
- Return type:
 
 - expires_at¶
- Returns the interaction’s expiration time in UTC. - This is exactly 15 minutes after the interaction was created. - New in version 2.5. - Type:
 
 - property guild[source]¶
- The guild the interaction was sent from. - Note - In some scenarios, e.g. for user-installed applications, this will usually be - None, despite the interaction originating from a guild. This will only return a full- Guildfor cached guilds, i.e. those the bot is already a member of.- To check whether an interaction was sent from a guild, consider using - guild_idor- contextinstead.
 - is_expired()[source]¶
- Whether the interaction can still be used to make requests to Discord. - This does not take into account the 3 second limit for the initial response. - New in version 2.5. - Return type:
 
 - me¶
- Similar to - Guild.me, except it may return the- ClientUserin private message contexts or when the bot is not a member of the guild (e.g. in the case of user-installed applications).- Type:
 
 - await original_response()[source]¶
- This function is a coroutine. - Fetches the original interaction response message associated with the interaction. - Repeated calls to this will return a cached value. - Changed in version 2.6: This function was renamed from - original_message.- Raises:
- HTTPException – Fetching the original response message failed. 
- Returns:
- The original interaction response message. 
- Return type:
 
 - property permissions[source]¶
- The resolved permissions of the member in the channel, including overwrites. - In a guild context, this is provided directly by Discord. - In a non-guild context this will be an instance of - Permissions.private_channel().- Type:
 
 - response¶
- Returns an object responsible for handling responding to the interaction. - A response can only be done once. If secondary messages need to be sent, consider using - followupinstead.- Type:
 
 - await send(content=None, *, embed=..., embeds=..., file=..., files=..., allowed_mentions=..., view=..., components=..., tts=False, ephemeral=..., suppress_embeds=..., flags=..., delete_after=..., poll=...)[source]¶
- This function is a coroutine. - Sends a message using either - response.send_messageor- followup.send.- If the interaction hasn’t been responded to yet, this method will call - response.send_message. Otherwise, it will call- followup.send.- Note - This method does not return a - Messageobject. If you need a message object, use- original_response()to fetch it, or use- followup.senddirectly instead of this method if you’re sending a followup message.- Parameters:
- embed ( - Embed) – The rich embed for the content to send. This cannot be mixed with the- embedsparameter.
- embeds ( - list[- Embed]) – A list of embeds to send with the content. Must be a maximum of 10. This cannot be mixed with the- embedparameter.
- file ( - File) – The file to upload. This cannot be mixed with the- filesparameter.
- files ( - list[- File]) – A list of files to upload. Must be a maximum of 10. This cannot be mixed with the- fileparameter.
- allowed_mentions ( - AllowedMentions) – Controls the mentions being processed in this message. If this is passed, then the object is merged with- Client.allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in- Client.allowed_mentions. If no object is passed at all then the defaults given by- Client.allowed_mentionsare used instead.
- tts ( - bool) – Whether the message should be sent using text-to-speech.
- view ( - disnake.ui.View) – The view to send with the message. This cannot be mixed with- components.
- components ( - UIComponent|- list[- UIComponent|- list[- WrappedComponent]]) –- A list of components to send with the message. This cannot be mixed with - view.- New in version 2.4. - Note - Passing v2 components here automatically sets the - is_components_v2flag. Setting this flag cannot be reverted. Note that this also disables the- content,- embeds, and- pollfields.
- ephemeral ( - bool) – Whether the message should only be visible to the user who started the interaction. If a view is sent with an ephemeral message and it has no timeout set then the timeout is set to 15 minutes.
- suppress_embeds ( - bool) –- Whether to suppress embeds for the message. This hides all the embeds from the UI if set to - True.- New in version 2.5. 
- flags ( - MessageFlags) –- The flags to set for this message. Only - suppress_embeds,- ephemeral,- suppress_notifications, and- is_components_v2are supported.- If parameters - suppress_embedsor- ephemeralare provided, they will override the corresponding setting of this- flagsparameter.- New in version 2.9. 
- delete_after ( - float) –- If provided, the number of seconds to wait in the background before deleting the message we just sent. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - expires_at/- is_expired).- Changed in version 2.7: Added support for ephemeral responses. 
- poll ( - Poll) –- The poll to send with the message. - New in version 2.10. 
 
- Raises:
- HTTPException – Sending the message failed. 
- TypeError – You specified both - embedand- embeds.
- ValueError – The length of - embedswas invalid, or you tried to send v2 components together with- content,- embeds, or- poll.
 
 
 
GuildCommandInteraction¶
- class disnake.GuildCommandInteraction[source]¶
- An - ApplicationCommandInteractionsubclass, primarily meant for annotations.- This restricts the command to only be usable in guilds and only as a guild-installed command, by automatically setting - ApplicationCommand.contextsto- guildonly and- ApplicationCommand.install_typesto- guildonly. Note that this does not apply to slash subcommands, subcommand groups, or autocomplete callbacks.- Additionally, the type annotations of - author,- guild,- guild_id,- guild_locale, and- meare modified to match the expected types in guilds.
UserCommandInteraction¶
- class disnake.UserCommandInteraction[source]¶
- An - ApplicationCommandInteractionsubclass meant for annotations in user context menu commands.- No runtime behavior is changed, but the type annotations of - targetare modified to match the expected type with user commands.
MessageCommandInteraction¶
- class disnake.MessageCommandInteraction[source]¶
- An - ApplicationCommandInteractionsubclass meant for annotations in message context menu commands.- No runtime behavior is changed, but the type annotations of - targetare modified to match the expected type with message commands.
MessageInteraction¶
- asyncdelete_original_message
- asyncdelete_original_response
- asyncedit_original_message
- asyncedit_original_response
- defis_expired
- asyncoriginal_message
- asyncoriginal_response
- asyncsend
- class disnake.MessageInteraction[source]¶
- Represents an interaction with a message component. - Current examples are buttons and dropdowns. - New in version 2.1. - type¶
- The interaction type. - Type:
 
 - channel¶
- The channel the interaction was sent from. - Note that due to a Discord limitation, DM channels may not contain recipient information. Unknown channel types will be - PartialMessageable.- Changed in version 2.10: If the interaction was sent from a thread and the bot cannot normally access the thread, this is now a proper - Threadobject. Private channels are now proper- DMChannel/- GroupChannelobjects instead of- PartialMessageable.- Note - If you want to compute the interaction author’s or bot’s permissions in the channel, consider using - permissionsor- app_permissions.- Type:
- abc.GuildChannel|- Thread|- abc.PrivateChannel|- PartialMessageable
 
 - author¶
- The user or member that sent the interaction. - Note - In scenarios where an interaction occurs in a guild but - guildis unavailable, such as with user-installed applications in guilds, some attributes of- Members that depend on the guild/role cache will not work due to an API limitation. This includes- roles,- top_role,- role_icon, and- guild_permissions.
 - guild_locale¶
- The selected language of the interaction’s guild. This value is only meaningful in guilds with - COMMUNITYfeature and receives a default value otherwise. If the interaction was in a DM, then this value is- None.- New in version 2.4. 
 - entitlements¶
- The entitlements for the invoking user and guild, representing access to an application subscription. - New in version 2.10. - Type:
 
 - authorizing_integration_owners¶
- Details about the authorizing user/guild for the application installation related to the interaction. - New in version 2.10. 
 - context¶
- The context where the interaction was triggered from. - This is a flag object, with exactly one of the flags set to - True. To check whether an interaction originated from e.g. a- guildcontext, you can use- if interaction.context.guild:.- New in version 2.10. - Type:
 
 - attachment_size_limit¶
- The maximum number of bytes files can have in responses to this interaction. - This may be higher than the default limit, depending on the guild’s boost status or the invoking user’s nitro status. - New in version 2.11. - Type:
 
 - data¶
- The wrapped interaction data. - Type:
 
 - original_message()[source]¶
- An alias of - original_response().
 - edit_original_message()[source]¶
- An alias of - edit_original_response().
 - delete_original_message()[source]¶
- An alias of - delete_original_response().
 - property values[source]¶
- The values the user selected. - For select menus of type - string_select, these are just the string values the user selected. For other select menu types, these are the IDs of the selected entities.- See also - resolved_values.
 - resolved_values¶
- The (resolved) values the user selected. - For select menus of type - string_select, this is equivalent to- values. For other select menu types, these are full objects corresponding to the selected entities.- New in version 2.7. - Type:
- Sequence[- str|- Member|- User|- Role|- abc.GuildChannel|- Thread|- PartialMessageable] |- None
 
 - component¶
- The component the user interacted with. - Type:
 
 - property app_permissions[source]¶
- The resolved permissions of the bot in the channel, including overwrites. - New in version 2.6. - Changed in version 2.10: This is now always provided by Discord. - Type:
 
 - await delete_original_response(*, delay=None)[source]¶
- This function is a coroutine. - Deletes the original interaction response message. - This is a lower level interface to - InteractionMessage.delete()in case you do not want to fetch the message and save an HTTP request.- Changed in version 2.6: This function was renamed from - delete_original_message.- Parameters:
- If provided, the number of seconds to wait in the background before deleting the original response message. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - Interaction.expires_at/- is_expired).
- Raises:
- HTTPException – Deleting the message failed. 
- Forbidden – Deleted a message that is not yours. 
 
 
 - await edit_original_response(content=..., *, embed=..., embeds=..., file=..., files=..., attachments=..., view=..., components=..., poll=..., suppress_embeds=..., flags=..., allowed_mentions=None, delete_after=None)[source]¶
- This function is a coroutine. - Edits the original, previously sent interaction response message. - This is a lower level interface to - InteractionMessage.edit()in case you do not want to fetch the message and save an HTTP request.- This method is also the only way to edit the original response if the message sent was ephemeral. - Note - If the original response message has embeds with images that were created from local files (using the - fileparameter with- Embed.set_image()or- Embed.set_thumbnail()), those images will be removed if the message’s attachments are edited in any way (i.e. by setting- file/- files/- attachments, or adding an embed with local files).- Changed in version 2.6: This function was renamed from - edit_original_message.- Parameters:
- content ( - str|- None) – The content to edit the message with, or- Noneto clear it.
- embed ( - Embed|- None) – The new embed to replace the original with. This cannot be mixed with the- embedsparameter. Could be- Noneto remove the embed.
- embeds ( - list[- Embed]) – The new embeds to replace the original with. Must be a maximum of 10. This cannot be mixed with the- embedparameter. To remove all embeds- []should be passed.
- file ( - File) – The file to upload. This cannot be mixed with the- filesparameter. Files will be appended to the message, see the- attachmentsparameter to remove/replace existing files.
- files ( - list[- File]) – A list of files to upload. This cannot be mixed with the- fileparameter. Files will be appended to the message, see the- attachmentsparameter to remove/replace existing files.
- attachments ( - list[- Attachment] |- None) –- A list of attachments to keep in the message. If - []or- Noneis passed then all existing attachments are removed. Keeps existing attachments if not provided.- New in version 2.2. - Changed in version 2.5: Supports passing - Noneto clear attachments.
- view ( - View|- None) – The updated view to update this message with. This cannot be mixed with- components. If- Noneis passed then the view is removed.
- components ( - UIComponent|- list[- UIComponent|- list[- WrappedComponent]] |- None) –- A list of components to update this message with. This cannot be mixed with - view. If- Noneis passed then the components are removed.- New in version 2.4. - Note - Passing v2 components here automatically sets the - is_components_v2flag. Setting this flag cannot be reverted. Note that this also disables the- contentand- embedsfields. If the message previously had any of these fields set, you must set them to- None.
- poll ( - Poll) –- A poll. This can only be sent after a defer. If not used after a defer the discord API ignore the field. - New in version 2.10. 
- allowed_mentions ( - AllowedMentions) – Controls the mentions being processed in this message. See- abc.Messageable.send()for more information.
- suppress_embeds ( - bool) –- Whether to suppress embeds for the message. This hides all the embeds from the UI if set to - True. If set to- False, this brings the embeds back if they were suppressed.- New in version 2.7. 
- flags ( - MessageFlags) –- The new flags to set for this message. Overrides existing flags. Only - suppress_embedsand- is_components_v2are supported.- If parameter - suppress_embedsis provided, that will override the setting of- MessageFlags.suppress_embeds.- New in version 2.9. 
- If provided, the number of seconds to wait in the background before deleting the message we just edited. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - Interaction.expires_at/- is_expired).- New in version 2.10. 
 
- Raises:
- HTTPException – Editing the message failed. 
- Forbidden – Edited a message that is not yours. 
- TypeError – You specified both - embedand- embedsor- fileand- files.
- ValueError – The length of - embedswas invalid, or you tried to send v2 components together with- contentor- embeds.
 
- Returns:
- The newly edited message. 
- Return type:
 
 - expires_at¶
- Returns the interaction’s expiration time in UTC. - This is exactly 15 minutes after the interaction was created. - New in version 2.5. - Type:
 
 - property guild[source]¶
- The guild the interaction was sent from. - Note - In some scenarios, e.g. for user-installed applications, this will usually be - None, despite the interaction originating from a guild. This will only return a full- Guildfor cached guilds, i.e. those the bot is already a member of.- To check whether an interaction was sent from a guild, consider using - guild_idor- contextinstead.
 - is_expired()[source]¶
- Whether the interaction can still be used to make requests to Discord. - This does not take into account the 3 second limit for the initial response. - New in version 2.5. - Return type:
 
 - me¶
- Similar to - Guild.me, except it may return the- ClientUserin private message contexts or when the bot is not a member of the guild (e.g. in the case of user-installed applications).- Type:
 
 - await original_response()[source]¶
- This function is a coroutine. - Fetches the original interaction response message associated with the interaction. - Repeated calls to this will return a cached value. - Changed in version 2.6: This function was renamed from - original_message.- Raises:
- HTTPException – Fetching the original response message failed. 
- Returns:
- The original interaction response message. 
- Return type:
 
 - property permissions[source]¶
- The resolved permissions of the member in the channel, including overwrites. - In a guild context, this is provided directly by Discord. - In a non-guild context this will be an instance of - Permissions.private_channel().- Type:
 
 - response¶
- Returns an object responsible for handling responding to the interaction. - A response can only be done once. If secondary messages need to be sent, consider using - followupinstead.- Type:
 
 - await send(content=None, *, embed=..., embeds=..., file=..., files=..., allowed_mentions=..., view=..., components=..., tts=False, ephemeral=..., suppress_embeds=..., flags=..., delete_after=..., poll=...)[source]¶
- This function is a coroutine. - Sends a message using either - response.send_messageor- followup.send.- If the interaction hasn’t been responded to yet, this method will call - response.send_message. Otherwise, it will call- followup.send.- Note - This method does not return a - Messageobject. If you need a message object, use- original_response()to fetch it, or use- followup.senddirectly instead of this method if you’re sending a followup message.- Parameters:
- embed ( - Embed) – The rich embed for the content to send. This cannot be mixed with the- embedsparameter.
- embeds ( - list[- Embed]) – A list of embeds to send with the content. Must be a maximum of 10. This cannot be mixed with the- embedparameter.
- file ( - File) – The file to upload. This cannot be mixed with the- filesparameter.
- files ( - list[- File]) – A list of files to upload. Must be a maximum of 10. This cannot be mixed with the- fileparameter.
- allowed_mentions ( - AllowedMentions) – Controls the mentions being processed in this message. If this is passed, then the object is merged with- Client.allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in- Client.allowed_mentions. If no object is passed at all then the defaults given by- Client.allowed_mentionsare used instead.
- tts ( - bool) – Whether the message should be sent using text-to-speech.
- view ( - disnake.ui.View) – The view to send with the message. This cannot be mixed with- components.
- components ( - UIComponent|- list[- UIComponent|- list[- WrappedComponent]]) –- A list of components to send with the message. This cannot be mixed with - view.- New in version 2.4. - Note - Passing v2 components here automatically sets the - is_components_v2flag. Setting this flag cannot be reverted. Note that this also disables the- content,- embeds, and- pollfields.
- ephemeral ( - bool) – Whether the message should only be visible to the user who started the interaction. If a view is sent with an ephemeral message and it has no timeout set then the timeout is set to 15 minutes.
- suppress_embeds ( - bool) –- Whether to suppress embeds for the message. This hides all the embeds from the UI if set to - True.- New in version 2.5. 
- flags ( - MessageFlags) –- The flags to set for this message. Only - suppress_embeds,- ephemeral,- suppress_notifications, and- is_components_v2are supported.- If parameters - suppress_embedsor- ephemeralare provided, they will override the corresponding setting of this- flagsparameter.- New in version 2.9. 
- delete_after ( - float) –- If provided, the number of seconds to wait in the background before deleting the message we just sent. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - expires_at/- is_expired).- Changed in version 2.7: Added support for ephemeral responses. 
- poll ( - Poll) –- The poll to send with the message. - New in version 2.10. 
 
- Raises:
- HTTPException – Sending the message failed. 
- TypeError – You specified both - embedand- embeds.
- ValueError – The length of - embedswas invalid, or you tried to send v2 components together with- content,- embeds, or- poll.
 
 
 
ModalInteraction¶
- app_permissions
- application_id
- attachment_size_limit
- author
- authorizing_integration_owners
- bot
- channel
- channel_id
- client
- context
- created_at
- custom_id
- data
- entitlements
- expires_at
- followup
- guild
- guild_id
- guild_locale
- id
- locale
- me
- message
- permissions
- resolved_values
- response
- text_values
- token
- type
- user
- values
- asyncdelete_original_message
- asyncdelete_original_response
- asyncedit_original_message
- asyncedit_original_response
- defis_expired
- asyncoriginal_message
- asyncoriginal_response
- asyncsend
- defwalk_raw_components
- class disnake.ModalInteraction[source]¶
- Represents an interaction with a modal. - New in version 2.4. - type¶
- The interaction type. - Type:
 
 - channel¶
- The channel the interaction was sent from. - Note that due to a Discord limitation, DM channels may not contain recipient information. Unknown channel types will be - PartialMessageable.- Changed in version 2.10: If the interaction was sent from a thread and the bot cannot normally access the thread, this is now a proper - Threadobject. Private channels are now proper- DMChannel/- GroupChannelobjects instead of- PartialMessageable.- Note - If you want to compute the interaction author’s or bot’s permissions in the channel, consider using - permissionsor- app_permissions.- Type:
- abc.GuildChannel|- Thread|- abc.PrivateChannel|- PartialMessageable
 
 - author¶
- The user or member that sent the interaction. - Note - In scenarios where an interaction occurs in a guild but - guildis unavailable, such as with user-installed applications in guilds, some attributes of- Members that depend on the guild/role cache will not work due to an API limitation. This includes- roles,- top_role,- role_icon, and- guild_permissions.
 - guild_locale¶
- The selected language of the interaction’s guild. This value is only meaningful in guilds with - COMMUNITYfeature and receives a default value otherwise. If the interaction was in a DM, then this value is- None.
 - entitlements¶
- The entitlements for the invoking user and guild, representing access to an application subscription. - New in version 2.10. - Type:
 
 - authorizing_integration_owners¶
- Details about the authorizing user/guild for the application installation related to the interaction. - New in version 2.10. 
 - context¶
- The context where the interaction was triggered from. - This is a flag object, with exactly one of the flags set to - True. To check whether an interaction originated from e.g. a- guildcontext, you can use- if interaction.context.guild:.- New in version 2.10. - Type:
 
 - attachment_size_limit¶
- The maximum number of bytes files can have in responses to this interaction. - This may be higher than the default limit, depending on the guild’s boost status or the invoking user’s nitro status. - New in version 2.11. - Type:
 
 - data¶
- The wrapped interaction data. - Type:
 
 - message¶
- The message that this interaction’s modal originated from, if the modal was sent in response to a component interaction. - New in version 2.5. 
 - original_message()[source]¶
- An alias of - original_response().
 - edit_original_message()[source]¶
- An alias of - edit_original_response().
 - delete_original_message()[source]¶
- An alias of - delete_original_response().
 - for ... in walk_raw_components()[source]¶
- Returns a generator that yields raw component data of the innermost/non-layout components one by one, as provided by Discord. This does not contain all fields of the components due to API limitations. - New in version 2.6. 
 - values¶
- Returns all raw values the user has entered in the modal. This is a dict of the form - {custom_id: value}.- For select menus, the corresponding dict value is a list of the values the user has selected. For select menus of type - string_select, these are just the string values the user selected; for other select menu types, these are the IDs of the selected entities.- See also - resolved_values.- New in version 2.11. 
 - resolved_values¶
- The (resolved) values the user entered in the modal. This is a dict of the form - {custom_id: value}.- For select menus, the corresponding dict value is a list of the values the user has selected. For select menus of type - string_select, this is equivalent to- values; for other select menu types, these are full objects corresponding to the selected entities.- For file uploads, the corresponding dict value is a list of files the user has uploaded. - New in version 2.11. - Type:
- dict[- str,- str|- Sequence[- str|- Member|- User|- Role|- abc.GuildChannel|- Thread|- PartialMessageable|- Attachment]]
 
 - text_values¶
- Returns the text values the user has entered in the modal. This is a dict of the form - {custom_id: value}.
 - property app_permissions[source]¶
- The resolved permissions of the bot in the channel, including overwrites. - New in version 2.6. - Changed in version 2.10: This is now always provided by Discord. - Type:
 
 - await delete_original_response(*, delay=None)[source]¶
- This function is a coroutine. - Deletes the original interaction response message. - This is a lower level interface to - InteractionMessage.delete()in case you do not want to fetch the message and save an HTTP request.- Changed in version 2.6: This function was renamed from - delete_original_message.- Parameters:
- If provided, the number of seconds to wait in the background before deleting the original response message. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - Interaction.expires_at/- is_expired).
- Raises:
- HTTPException – Deleting the message failed. 
- Forbidden – Deleted a message that is not yours. 
 
 
 - await edit_original_response(content=..., *, embed=..., embeds=..., file=..., files=..., attachments=..., view=..., components=..., poll=..., suppress_embeds=..., flags=..., allowed_mentions=None, delete_after=None)[source]¶
- This function is a coroutine. - Edits the original, previously sent interaction response message. - This is a lower level interface to - InteractionMessage.edit()in case you do not want to fetch the message and save an HTTP request.- This method is also the only way to edit the original response if the message sent was ephemeral. - Note - If the original response message has embeds with images that were created from local files (using the - fileparameter with- Embed.set_image()or- Embed.set_thumbnail()), those images will be removed if the message’s attachments are edited in any way (i.e. by setting- file/- files/- attachments, or adding an embed with local files).- Changed in version 2.6: This function was renamed from - edit_original_message.- Parameters:
- content ( - str|- None) – The content to edit the message with, or- Noneto clear it.
- embed ( - Embed|- None) – The new embed to replace the original with. This cannot be mixed with the- embedsparameter. Could be- Noneto remove the embed.
- embeds ( - list[- Embed]) – The new embeds to replace the original with. Must be a maximum of 10. This cannot be mixed with the- embedparameter. To remove all embeds- []should be passed.
- file ( - File) – The file to upload. This cannot be mixed with the- filesparameter. Files will be appended to the message, see the- attachmentsparameter to remove/replace existing files.
- files ( - list[- File]) – A list of files to upload. This cannot be mixed with the- fileparameter. Files will be appended to the message, see the- attachmentsparameter to remove/replace existing files.
- attachments ( - list[- Attachment] |- None) –- A list of attachments to keep in the message. If - []or- Noneis passed then all existing attachments are removed. Keeps existing attachments if not provided.- New in version 2.2. - Changed in version 2.5: Supports passing - Noneto clear attachments.
- view ( - View|- None) – The updated view to update this message with. This cannot be mixed with- components. If- Noneis passed then the view is removed.
- components ( - UIComponent|- list[- UIComponent|- list[- WrappedComponent]] |- None) –- A list of components to update this message with. This cannot be mixed with - view. If- Noneis passed then the components are removed.- New in version 2.4. - Note - Passing v2 components here automatically sets the - is_components_v2flag. Setting this flag cannot be reverted. Note that this also disables the- contentand- embedsfields. If the message previously had any of these fields set, you must set them to- None.
- poll ( - Poll) –- A poll. This can only be sent after a defer. If not used after a defer the discord API ignore the field. - New in version 2.10. 
- allowed_mentions ( - AllowedMentions) – Controls the mentions being processed in this message. See- abc.Messageable.send()for more information.
- suppress_embeds ( - bool) –- Whether to suppress embeds for the message. This hides all the embeds from the UI if set to - True. If set to- False, this brings the embeds back if they were suppressed.- New in version 2.7. 
- flags ( - MessageFlags) –- The new flags to set for this message. Overrides existing flags. Only - suppress_embedsand- is_components_v2are supported.- If parameter - suppress_embedsis provided, that will override the setting of- MessageFlags.suppress_embeds.- New in version 2.9. 
- If provided, the number of seconds to wait in the background before deleting the message we just edited. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - Interaction.expires_at/- is_expired).- New in version 2.10. 
 
- Raises:
- HTTPException – Editing the message failed. 
- Forbidden – Edited a message that is not yours. 
- TypeError – You specified both - embedand- embedsor- fileand- files.
- ValueError – The length of - embedswas invalid, or you tried to send v2 components together with- contentor- embeds.
 
- Returns:
- The newly edited message. 
- Return type:
 
 - expires_at¶
- Returns the interaction’s expiration time in UTC. - This is exactly 15 minutes after the interaction was created. - New in version 2.5. - Type:
 
 - property guild[source]¶
- The guild the interaction was sent from. - Note - In some scenarios, e.g. for user-installed applications, this will usually be - None, despite the interaction originating from a guild. This will only return a full- Guildfor cached guilds, i.e. those the bot is already a member of.- To check whether an interaction was sent from a guild, consider using - guild_idor- contextinstead.
 - is_expired()[source]¶
- Whether the interaction can still be used to make requests to Discord. - This does not take into account the 3 second limit for the initial response. - New in version 2.5. - Return type:
 
 - me¶
- Similar to - Guild.me, except it may return the- ClientUserin private message contexts or when the bot is not a member of the guild (e.g. in the case of user-installed applications).- Type:
 
 - await original_response()[source]¶
- This function is a coroutine. - Fetches the original interaction response message associated with the interaction. - Repeated calls to this will return a cached value. - Changed in version 2.6: This function was renamed from - original_message.- Raises:
- HTTPException – Fetching the original response message failed. 
- Returns:
- The original interaction response message. 
- Return type:
 
 - property permissions[source]¶
- The resolved permissions of the member in the channel, including overwrites. - In a guild context, this is provided directly by Discord. - In a non-guild context this will be an instance of - Permissions.private_channel().- Type:
 
 - response¶
- Returns an object responsible for handling responding to the interaction. - A response can only be done once. If secondary messages need to be sent, consider using - followupinstead.- Type:
 
 - await send(content=None, *, embed=..., embeds=..., file=..., files=..., allowed_mentions=..., view=..., components=..., tts=False, ephemeral=..., suppress_embeds=..., flags=..., delete_after=..., poll=...)[source]¶
- This function is a coroutine. - Sends a message using either - response.send_messageor- followup.send.- If the interaction hasn’t been responded to yet, this method will call - response.send_message. Otherwise, it will call- followup.send.- Note - This method does not return a - Messageobject. If you need a message object, use- original_response()to fetch it, or use- followup.senddirectly instead of this method if you’re sending a followup message.- Parameters:
- embed ( - Embed) – The rich embed for the content to send. This cannot be mixed with the- embedsparameter.
- embeds ( - list[- Embed]) – A list of embeds to send with the content. Must be a maximum of 10. This cannot be mixed with the- embedparameter.
- file ( - File) – The file to upload. This cannot be mixed with the- filesparameter.
- files ( - list[- File]) – A list of files to upload. Must be a maximum of 10. This cannot be mixed with the- fileparameter.
- allowed_mentions ( - AllowedMentions) – Controls the mentions being processed in this message. If this is passed, then the object is merged with- Client.allowed_mentions. The merging behaviour only overrides attributes that have been explicitly passed to the object, otherwise it uses the attributes set in- Client.allowed_mentions. If no object is passed at all then the defaults given by- Client.allowed_mentionsare used instead.
- tts ( - bool) – Whether the message should be sent using text-to-speech.
- view ( - disnake.ui.View) – The view to send with the message. This cannot be mixed with- components.
- components ( - UIComponent|- list[- UIComponent|- list[- WrappedComponent]]) –- A list of components to send with the message. This cannot be mixed with - view.- New in version 2.4. - Note - Passing v2 components here automatically sets the - is_components_v2flag. Setting this flag cannot be reverted. Note that this also disables the- content,- embeds, and- pollfields.
- ephemeral ( - bool) – Whether the message should only be visible to the user who started the interaction. If a view is sent with an ephemeral message and it has no timeout set then the timeout is set to 15 minutes.
- suppress_embeds ( - bool) –- Whether to suppress embeds for the message. This hides all the embeds from the UI if set to - True.- New in version 2.5. 
- flags ( - MessageFlags) –- The flags to set for this message. Only - suppress_embeds,- ephemeral,- suppress_notifications, and- is_components_v2are supported.- If parameters - suppress_embedsor- ephemeralare provided, they will override the corresponding setting of this- flagsparameter.- New in version 2.9. 
- delete_after ( - float) –- If provided, the number of seconds to wait in the background before deleting the message we just sent. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - expires_at/- is_expired).- Changed in version 2.7: Added support for ephemeral responses. 
- poll ( - Poll) –- The poll to send with the message. - New in version 2.10. 
 
- Raises:
- HTTPException – Sending the message failed. 
- TypeError – You specified both - embedand- embeds.
- ValueError – The length of - embedswas invalid, or you tried to send v2 components together with- content,- embeds, or- poll.
 
 
 
InteractionResponse¶
- asyncautocomplete
- asyncdefer
- asyncedit_message
- defis_done
- asyncpong
- asyncrequire_premium
- asyncsend_message
- asyncsend_modal
- class disnake.InteractionResponse[source]¶
- Represents a Discord interaction response. - This type can be accessed through - Interaction.response.- New in version 2.0. - property type[source]¶
- If a response was successfully made, this is the type of the response. - New in version 2.6. - Type:
 
 - is_done()[source]¶
- Whether an interaction response has been done before. - An interaction can only be responded to once. - Return type:
 
 - await defer(*, with_message=..., ephemeral=...)[source]¶
- This function is a coroutine. - Defers the interaction response. - This is typically used when the interaction is acknowledged and a secondary action will be done later. - Changed in version 2.5: Raises - TypeErrorwhen an interaction cannot be deferred.- Parameters:
- with_message ( - bool) –- Whether the response will be a separate message with thinking state (bot is thinking…). This only applies to interactions of type - InteractionType.component(default- False) and- InteractionType.modal_submit(default- True).- Truecorresponds to a- deferred_channel_messageresponse type, while- Falsecorresponds to- deferred_message_update.- Note - Responses to interactions of type - InteractionType.application_commandmust defer using a message, i.e. this will effectively always be- Truefor those.- New in version 2.4. - Changed in version 2.6: Added support for setting this to - Falsein modal interactions.
- ephemeral ( - bool) –- Whether the deferred message will eventually be ephemeral. This applies to interactions of type - InteractionType.application_command, or when the- with_messageparameter is- True.- Defaults to - False.
 
- Raises:
- HTTPException – Deferring the interaction failed. 
- InteractionResponded – This interaction has already been responded to before. 
- TypeError – This interaction cannot be deferred. 
 
 
 - await pong()[source]¶
- This function is a coroutine. - Pongs the ping interaction. - This should rarely be used. - Raises:
- HTTPException – Ponging the interaction failed. 
- InteractionResponded – This interaction has already been responded to before. 
 
 
 - await send_message(content=None, *, embed=..., embeds=..., file=..., files=..., allowed_mentions=..., view=..., components=..., tts=False, ephemeral=..., suppress_embeds=..., flags=..., delete_after=..., poll=...)[source]¶
- This function is a coroutine. - Responds to this interaction by sending a message. - Parameters:
- embed ( - Embed) – The rich embed for the content to send. This cannot be mixed with the- embedsparameter.
- embeds ( - list[- Embed]) – A list of embeds to send with the content. Must be a maximum of 10. This cannot be mixed with the- embedparameter.
- file ( - File) – The file to upload. This cannot be mixed with the- filesparameter.
- files ( - list[- File]) – A list of files to upload. Must be a maximum of 10. This cannot be mixed with the- fileparameter.
- allowed_mentions ( - AllowedMentions) – Controls the mentions being processed in this message.
- view ( - disnake.ui.View) – The view to send with the message. This cannot be mixed with- components.
- components ( - UIComponent|- list[- UIComponent|- list[- WrappedComponent]]) –- A list of components to send with the message. This cannot be mixed with - view.- New in version 2.4. - Note - Passing v2 components here automatically sets the - is_components_v2flag. Setting this flag cannot be reverted. Note that this also disables the- content,- embeds, and- pollfields.
- tts ( - bool) – Whether the message should be sent using text-to-speech.
- ephemeral ( - bool) – Whether the message should only be visible to the user who started the interaction. If a view is sent with an ephemeral message and it has no timeout set then the timeout is set to 15 minutes.
- delete_after ( - float) –- If provided, the number of seconds to wait in the background before deleting the message we just sent. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - Interaction.expires_at/- is_expired).- Changed in version 2.7: Added support for ephemeral responses. 
- suppress_embeds ( - bool) –- Whether to suppress embeds for the message. This hides all the embeds from the UI if set to - True.- New in version 2.5. 
- flags ( - MessageFlags) –- The flags to set for this message. Only - suppress_embeds,- ephemeral,- suppress_notifications, and- is_components_v2are supported.- If parameters - suppress_embedsor- ephemeralare provided, they will override the corresponding setting of this- flagsparameter.- New in version 2.9. 
- poll ( - Poll) –- The poll to send with the message. - New in version 2.10. 
 
- Raises:
- HTTPException – Sending the message failed. 
- TypeError – You specified both - embedand- embeds.
- ValueError – The length of - embedswas invalid, or you tried to send v2 components together with- content,- embeds, or- poll.
- InteractionResponded – This interaction has already been responded to before. 
 
 
 - await edit_message(content=..., *, embed=..., embeds=..., file=..., files=..., attachments=..., view=..., components=..., flags=..., allowed_mentions=..., delete_after=None)[source]¶
- This function is a coroutine. - Responds to this interaction by editing the original message of a component interaction or modal interaction (if the modal was sent in response to a component interaction). - Changed in version 2.5: Now supports editing the original message of modal interactions that started from a component. - Note - If the original message has embeds with images that were created from local files (using the - fileparameter with- Embed.set_image()or- Embed.set_thumbnail()), those images will be removed if the message’s attachments are edited in any way (i.e. by setting- file/- files/- attachments, or adding an embed with local files).- Parameters:
- content ( - str|- None) – The new content to replace the message with.- Noneremoves the content.
- embed ( - Embed|- None) – The new embed to replace the original with. This cannot be mixed with the- embedsparameter. Could be- Noneto remove the embed.
- embeds ( - list[- Embed]) – The new embeds to replace the original with. Must be a maximum of 10. This cannot be mixed with the- embedparameter. To remove all embeds- []should be passed.
- file ( - File) –- The file to upload. This cannot be mixed with the - filesparameter. Files will be appended to the message.- New in version 2.2. 
- A list of files to upload. This cannot be mixed with the - fileparameter. Files will be appended to the message.- New in version 2.2. 
- attachments ( - list[- Attachment] |- None) –- A list of attachments to keep in the message. If - []or- Noneis passed then all existing attachments are removed. Keeps existing attachments if not provided.- New in version 2.4. - Changed in version 2.5: Supports passing - Noneto clear attachments.
- view ( - View|- None) – The updated view to update this message with. This cannot be mixed with- components. If- Noneis passed then the view is removed.
- components ( - UIComponent|- list[- UIComponent|- list[- WrappedComponent]] |- None) –- A list of components to update this message with. This cannot be mixed with - view. If- Noneis passed then the components are removed.- New in version 2.4. - Note - Passing v2 components here automatically sets the - is_components_v2flag. Setting this flag cannot be reverted. Note that this also disables the- contentand- embedsfields. If the message previously had any of these fields set, you must set them to- None.
- flags ( - MessageFlags) –- The new flags to set for this message. Overrides existing flags. Only - suppress_embedsand- is_components_v2are supported.- New in version 2.11. 
- allowed_mentions ( - AllowedMentions) – Controls the mentions being processed in this message.
- If provided, the number of seconds to wait in the background before deleting the message we just edited. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - Interaction.expires_at/- is_expired).- New in version 2.10. 
 
- Raises:
- HTTPException – Editing the message failed. 
- TypeError – You specified both - embedand- embeds.
- ValueError – You tried to send v2 components together with - contentor- embeds.
- InteractionResponded – This interaction has already been responded to before. 
 
 
 - await autocomplete(*, choices)[source]¶
- This function is a coroutine. - Responds to this interaction by displaying a list of possible autocomplete results. Only works for autocomplete interactions. - Parameters:
- choices ( - Sequence[- OptionChoice] |- Sequence[- str|- int|- float] |- Mapping[- str,- str|- int|- float]) – The choices to suggest.
- Raises:
- HTTPException – Autocomplete response has failed. 
- InteractionResponded – This interaction has already been responded to before. 
 
 
 - await send_modal(modal=None, *, title=None, custom_id=None, components=None)[source]¶
- This function is a coroutine. - Responds to this interaction by displaying a modal. - New in version 2.4. - Note - Not passing the - modalparameter here will not register a callback, and a- on_modal_submit()interaction will need to be handled manually.- Parameters:
- modal ( - Modal) – The modal to display. This cannot be mixed with the- title,- custom_idand- componentsparameters.
- title ( - str) – The title of the modal. This cannot be mixed with the- modalparameter.
- custom_id ( - str) – The ID of the modal that gets received during an interaction. This cannot be mixed with the- modalparameter.
- components ( - UIComponent|- list[- UIComponent]) –- The components to display in the modal. A maximum of 5. - See - Modal.componentsfor supported components.- This cannot be mixed with the - modalparameter.- Changed in version 2.11: Using action rows in modals or passing - ui.TextInputdirectly (which implicitly wraps it in an action row) is deprecated. Use- ui.TextInputinside a- ui.Labelinstead.
 
- Raises:
- TypeError – Cannot mix the - modalparameter and the- title,- custom_id,- componentsparameters.
- ValueError – Maximum number of components (5) exceeded. 
- HTTPException – Displaying the modal failed. 
- ModalChainNotSupported – This interaction cannot be responded with a modal. 
- InteractionResponded – This interaction has already been responded to before. 
 
 
 - This function is a coroutine. - Responds to this interaction with a message containing an upgrade button. - Only available for applications with monetization enabled. - New in version 2.10. - Example - Require an application subscription for a command: - @bot.slash_command() async def cool_command(inter: disnake.ApplicationCommandInteraction): if not inter.entitlements: await inter.response.require_premium() return # skip remaining code ... - Raises:
- HTTPException – Sending the response has failed. 
- InteractionResponded – This interaction has already been responded to before. 
 
 
 
InteractionMessage¶
- attachments
- author
- channel
- channel_mentions
- clean_content
- components
- content
- created_at
- edited_at
- embeds
- flags
- guild
- id
- interaction
- interaction_metadata
- jump_url
- mention_everyone
- mentions
- pinned
- pinned_at
- poll
- raw_channel_mentions
- raw_mentions
- raw_role_mentions
- reactions
- reference
- role_mentions
- stickers
- system_content
- thread
- type
- webhook_id
- asyncadd_reaction
- asyncclear_reaction
- asyncclear_reactions
- asynccreate_thread
- asyncdelete
- asyncedit
- asyncforward
- defis_system
- asyncpin
- asyncpublish
- asyncremove_reaction
- asyncreply
- defto_reference
- asyncunpin
- class disnake.InteractionMessage[source]¶
- Represents the original interaction response message. - This allows you to edit or delete the message associated with the interaction response. To retrieve this object see - Interaction.original_response().- This inherits from - disnake.Messagewith changes to- edit()and- delete()to work.- New in version 2.0. - type¶
- The type of message. - Type:
 
 - channel¶
- The channel that the message was sent from. Could be a - DMChannelor- GroupChannelif it’s a private message.- Type:
- TextChannel|- VoiceChannel|- StageChannel|- Thread|- DMChannel|- GroupChannel|- PartialMessageable
 
 - reference¶
- The message that this message references. This is only applicable to message replies. - Type:
 
 - interaction_metadata¶
- The metadata about the interaction that caused this message, if any. - New in version 2.10. - Type:
 
 - mention_everyone¶
- Specifies if the message mentions everyone. - Note - This does not check if the - @everyoneor the- @heretext is in the message itself. Rather this boolean indicates if either the- @everyoneor the- @heretext is in the message and it did end up mentioning.- Type:
 
 - mentions¶
- A list of - Memberthat were mentioned. If the message is in a private message then the list will be of- Userinstead.- Warning - The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library. 
 - role_mentions¶
- A list of - Rolethat were mentioned. If the message is in a private message then the list is always empty.
 - attachments¶
- A list of attachments given to a message. - Type:
 
 - flags¶
- Extra features of the message. - Type:
 
 - reactions¶
- Reactions to a message. Reactions can be either custom emoji or standard unicode emoji. 
 - stickers¶
- A list of sticker items given to the message. - Type:
 
 - await edit(content=..., *, embed=..., embeds=..., file=..., files=..., attachments=..., suppress_embeds=..., flags=..., allowed_mentions=..., view=..., components=..., delete_after=None)[source]¶
- This function is a coroutine. - Edits the message. - Note - If the original message has embeds with images that were created from local files (using the - fileparameter with- Embed.set_image()or- Embed.set_thumbnail()), those images will be removed if the message’s attachments are edited in any way (i.e. by setting- file/- files/- attachments, or adding an embed with local files).- Parameters:
- content ( - str|- None) – The content to edit the message with, or- Noneto clear it.
- embed ( - Embed|- None) – The new embed to replace the original with. This cannot be mixed with the- embedsparameter. Could be- Noneto remove the embed.
- embeds ( - list[- Embed]) – The new embeds to replace the original with. Must be a maximum of 10. This cannot be mixed with the- embedparameter. To remove all embeds- []should be passed.
- file ( - File) – The file to upload. This cannot be mixed with the- filesparameter. Files will be appended to the message, see the- attachmentsparameter to remove/replace existing files.
- files ( - list[- File]) – A list of files to upload. This cannot be mixed with the- fileparameter. Files will be appended to the message, see the- attachmentsparameter to remove/replace existing files.
- attachments ( - list[- Attachment] |- None) –- A list of attachments to keep in the message. If - []or- Noneis passed then all existing attachments are removed. Keeps existing attachments if not provided.- New in version 2.2. - Changed in version 2.5: Supports passing - Noneto clear attachments.
- view ( - View|- None) – The updated view to update this message with. This cannot be mixed with- components. If- Noneis passed then the view is removed.
- components ( - UIComponent|- list[- UIComponent|- list[- WrappedComponent]] |- None) –- A list of components to update this message with. This cannot be mixed with - view. If- Noneis passed then the components are removed.- New in version 2.4. - Note - Passing v2 components here automatically sets the - is_components_v2flag. Setting this flag cannot be reverted. Note that this also disables the- contentand- embedsfields. If the message previously had any of these fields set, you must set them to- None.
- suppress_embeds ( - bool) –- Whether to suppress embeds for the message. This hides all the embeds from the UI if set to - True. If set to- False, this brings the embeds back if they were suppressed.- New in version 2.7. 
- flags ( - MessageFlags) –- The new flags to set for this message. Overrides existing flags. Only - suppress_embedsand- is_components_v2are supported.- If parameter - suppress_embedsis provided, that will override the setting of- MessageFlags.suppress_embeds.- New in version 2.9. 
- allowed_mentions ( - AllowedMentions) – Controls the mentions being processed in this message. See- abc.Messageable.send()for more information.
- If provided, the number of seconds to wait in the background before deleting the message we just edited. If the deletion fails, then it is silently ignored. - Can be up to 15 minutes after the interaction was created (see also - Interaction.expires_at/- is_expired).- New in version 2.10. 
 
- Raises:
- HTTPException – Editing the message failed. 
- Forbidden – Edited a message that is not yours. 
- TypeError – You specified both - embedand- embedsor- fileand- files.
- ValueError – The length of - embedswas invalid, or you tried to send v2 components together with- contentor- embeds.
 
- Returns:
- The newly edited message. 
- Return type:
 
 - await delete(*, delay=None)[source]¶
- This function is a coroutine. - Deletes the message. - Parameters:
- delay ( - float|- None) – If provided, the number of seconds to wait before deleting the message. The waiting is done in the background and deletion failures are ignored.
- Raises:
- Forbidden – You do not have proper permissions to delete the message. 
- NotFound – The message was deleted already. 
- HTTPException – Deleting the message failed. 
 
 
 - await add_reaction(emoji)[source]¶
- This function is a coroutine. - Adds a reaction to the message. - The emoji may be a unicode emoji or a custom guild - Emoji.- You must have the - read_message_historypermission to use this. If nobody else has reacted to the message using this emoji, the- add_reactionspermission is required.- Changed in version 2.6: Raises - TypeErrorinstead of- InvalidArgument.- Parameters:
- emoji ( - Emoji|- Reaction|- PartialEmoji|- str) – The emoji to react with.
- Raises:
- HTTPException – Adding the reaction failed. 
- Forbidden – You do not have the proper permissions to react to the message. 
- NotFound – The emoji you specified was not found. 
- TypeError – The emoji parameter is invalid. 
 
 
 - channel_mentions¶
- A list of - abc.GuildChannelthat were mentioned. If the message is in a private message then the list is always empty.- Type:
 
 - clean_content¶
- A property that returns the content in a “cleaned up” manner. This basically means that mentions are transformed into the way the client shows it. e.g. - <#id>will transform into- #name.- This will also transform @everyone and @here mentions into non-mentions. - Note - This does not affect markdown. If you want to escape or remove markdown then use - utils.escape_markdown()or- utils.remove_markdown()respectively, along with this function.- Type:
 
 - await clear_reaction(emoji)[source]¶
- This function is a coroutine. - Clears a specific reaction from the message. - The emoji may be a unicode emoji or a custom guild - Emoji.- You need the - manage_messagespermission to use this.- New in version 1.3. - Changed in version 2.6: Raises - TypeErrorinstead of- InvalidArgument.- Parameters:
- emoji ( - Emoji|- Reaction|- PartialEmoji|- str) – The emoji to clear.
- Raises:
- HTTPException – Clearing the reaction failed. 
- Forbidden – You do not have the proper permissions to clear the reaction. 
- NotFound – The emoji you specified was not found. 
- TypeError – The emoji parameter is invalid. 
 
 
 - await clear_reactions()[source]¶
- This function is a coroutine. - Removes all the reactions from the message. - You need the - manage_messagespermission to use this.- Raises:
- HTTPException – Removing the reactions failed. 
- Forbidden – You do not have the proper permissions to remove all the reactions. 
 
 
 - await create_thread(*, name, auto_archive_duration=None, slowmode_delay=None, reason=None)[source]¶
- This function is a coroutine. - Creates a public thread from this message. - You must have - create_public_threadsin order to create a public thread from a message.- The channel this message belongs in must be a - TextChannel.- New in version 2.0. - Changed in version 2.6: Raises - TypeErrorinstead of- InvalidArgument.- Parameters:
- name ( - str) – The name of the thread.
- auto_archive_duration ( - int|- ThreadArchiveDuration) – The duration in minutes before a thread is automatically archived for inactivity. If not provided, the channel’s default auto archive duration is used. Must be one of- 60,- 1440,- 4320, or- 10080.
- Specifies the slowmode rate limit for users in this thread, in seconds. A value of - 0disables slowmode. The maximum value possible is- 21600. If set to- Noneor not provided, slowmode is inherited from the parent’s- default_thread_slowmode_delay.- New in version 2.3. 
- The reason for creating the thread. Shows up on the audit log. - New in version 2.5. 
 
- Raises:
- Forbidden – You do not have permissions to create a thread. 
- HTTPException – Creating the thread failed. 
- TypeError – This message does not have guild info attached. 
 
- Returns:
- The created thread. 
- Return type:
 
 - property edited_at[source]¶
- An aware UTC datetime object containing the edited time of the message. - Type:
 
 - await forward(channel)[source]¶
- This function is a coroutine. - A shortcut method to - abc.Messageable.send()to forward a- Message.- New in version 2.10. - Parameters:
- channel ( - TextChannel|- VoiceChannel|- StageChannel|- Thread|- DMChannel|- GroupChannel|- PartialMessageable) – The channel where the message should be forwarded to.
- Raises:
- HTTPException – Sending the message failed. 
- Forbidden – You do not have the proper permissions to send the message. 
 
- Returns:
- The message that was sent. 
- Return type:
 
 - property interaction[source]¶
- The interaction that this message references. This exists only when the message is a response to an interaction without an existing message. - New in version 2.1. - Deprecated since version 2.10: Use - interaction_metadatainstead.- Type:
 
 - is_system()[source]¶
- Whether the message is a system message. - A system message is a message that is constructed entirely by the Discord API in response to something. - New in version 1.3. - Return type:
 
 - await pin(*, reason=None)[source]¶
- This function is a coroutine. - Pins the message. - You must have the - pin_messagespermission to do this in a non-private channel context.- This does not work with messages sent in a - VoiceChannelor- StageChannel.- Parameters:
- The reason for pinning the message. Shows up on the audit log. - New in version 1.4. 
- Raises:
- Forbidden – You do not have permissions to pin the message. 
- NotFound – The message or channel was not found or deleted. 
- HTTPException – Pinning the message failed, probably due to the channel having more than 50 pinned messages or the channel not supporting pins. 
 
 
 - property pinned_at[source]¶
- An aware UTC datetime object containing the pin time of the message. - Note - This is only set on messages retrieved using - abc.Messageable.pins().- New in version 2.11. - Type:
 
 - await publish()[source]¶
- This function is a coroutine. - Publishes this message to your announcement channel. - You must have the - send_messagespermission to do this.- If the message is not your own then the - manage_messagespermission is also needed.- Raises:
- Forbidden – You do not have the proper permissions to publish this message. 
- HTTPException – Publishing the message failed. 
 
 
 - raw_channel_mentions¶
- A property that returns an array of channel IDs matched with the syntax of - <#channel_id>in the message content.
 - raw_mentions¶
- A property that returns an array of user IDs matched with the syntax of - <@user_id>in the message content.- This allows you to receive the user IDs of mentioned users even in a private message context. 
 - raw_role_mentions¶
- A property that returns an array of role IDs matched with the syntax of - <@&role_id>in the message content.
 - await remove_reaction(emoji, member)[source]¶
- This function is a coroutine. - Removes a reaction by the member from the message. - The emoji may be a unicode emoji or a custom guild - Emoji.- If the reaction is not your own (i.e. - memberparameter is not you) then the- manage_messagespermission is needed.- The - memberparameter must represent a member and meet the- abc.Snowflakeabc.- Changed in version 2.6: Raises - TypeErrorinstead of- InvalidArgument.- Parameters:
- emoji ( - Emoji|- Reaction|- PartialEmoji|- str) – The emoji to remove.
- member ( - abc.Snowflake) – The member for which to remove the reaction.
 
- Raises:
- HTTPException – Removing the reaction failed. 
- Forbidden – You do not have the proper permissions to remove the reaction. 
- NotFound – The member or emoji you specified was not found. 
- TypeError – The emoji parameter is invalid. 
 
 
 - await reply(content=None, *, fail_if_not_exists=True, **kwargs)[source]¶
- This function is a coroutine. - A shortcut method to - abc.Messageable.send()to reply to the- Message.- New in version 1.6. - Changed in version 2.3: Added - fail_if_not_existskeyword argument. Defaults to- True.- Changed in version 2.6: Raises - TypeErroror- ValueErrorinstead of- InvalidArgument.- Parameters:
- fail_if_not_exists ( - bool) –- Whether replying using the message reference should raise - HTTPExceptionif the message no longer exists or Discord could not fetch the message.- New in version 2.3. 
- Raises:
- HTTPException – Sending the message failed. 
- Forbidden – You do not have the proper permissions to send the message. 
- TypeError – You specified both - embedand- embeds, or- fileand- files, or- viewand- components.
- ValueError – The - filesor- embedslist is too large.
 
- Returns:
- The message that was sent. 
- Return type:
 
 - system_content¶
- A property that returns the content that is rendered regardless of the - Message.type.- In the case of - MessageType.defaultand- MessageType.reply, this just returns the regular- Message.content. Otherwise this returns an English message denoting the contents of the system message.- If the message type is unrecognised this method will return - None.
 - property thread[source]¶
- The thread started from this message. - Noneif no thread has been started.- New in version 2.4. 
 - to_reference(*, type=MessageReferenceType.default, fail_if_not_exists=True)[source]¶
- Creates a - MessageReferencefrom the current message.- New in version 1.6. - Parameters:
- type ( - MessageReferenceType) –- The type of the message reference. This is used to control whether to reply to or forward a message. Defaults to replying. - New in version 2.10. 
- fail_if_not_exists ( - bool) –- Whether replying using the message reference should raise - HTTPExceptionif the message no longer exists or Discord could not fetch the message.- New in version 1.7. 
 
- Returns:
- The reference to this message. 
- Return type:
 
 - await unpin(*, reason=None)[source]¶
- This function is a coroutine. - Unpins the message. - You must have the - pin_messagespermission to do this in a non-private channel context.- Parameters:
- The reason for unpinning the message. Shows up on the audit log. - New in version 1.4. 
- Raises:
- Forbidden – You do not have permissions to unpin the message. 
- NotFound – The message or channel was not found or deleted. 
- HTTPException – Unpinning the message failed. 
 
 
 
InteractionDataResolved¶
- class disnake.InteractionDataResolved[source]¶
- Represents the resolved data related to an interaction. - New in version 2.1. - Changed in version 2.7: Renamed from - ApplicationCommandInteractionDataResolvedto- InteractionDataResolved.- members¶
- A mapping of IDs to partial members ( - deafand- muteattributes are missing).
 - channels¶
- A mapping of IDs to partial channels (only - id,- nameand- permissionsare included, threads also have- thread_metadataand- parent_id).- Type:
- dict[- int,- abc.GuildChannel|- Thread|- abc.PrivateChannel|- PartialMessageable]
 
 - attachments¶
- A mapping of IDs to attachments. - New in version 2.4. - Type:
 
 
ApplicationCommandInteractionData¶
ApplicationCommandInteractionDataOption¶
MessageInteractionData¶
- class disnake.MessageInteractionData[source]¶
- Represents the data of an interaction with a message component. - New in version 2.1. - component_type¶
- The type of the component. - Type:
 
 - values¶
- The values the user has selected in a select menu. For non-string select menus, this contains IDs for use with - resolved.
 - resolved¶
- All resolved objects related to this interaction. - New in version 2.7. - Type:
 
 
ModalInteractionData¶
- class disnake.ModalInteractionData[source]¶
- Represents the data of an interaction with a modal. - New in version 2.4. - components¶
- The raw component data of the modal interaction, as provided by Discord. This does not contain all fields of the components due to API limitations. - New in version 2.6. 
 - resolved¶
- All resolved objects related to this interaction. - New in version 2.11. - Type:
 
 
Data Classes¶
Enumerations¶
InteractionType¶
- class disnake.InteractionType[source]¶
- Specifies the type of - Interaction.- New in version 2.0. - ping¶
- Represents Discord pinging to see if the interaction response server is alive. 
 - application_command¶
- Represents an application command interaction. 
 - component¶
- Represents a component based interaction, i.e. using the Discord Bot UI Kit. 
 - application_command_autocomplete¶
- Represents an application command autocomplete interaction. 
 - modal_submit¶
- Represents a modal submit interaction. 
 
InteractionResponseType¶
- class disnake.InteractionResponseType[source]¶
- Specifies the response type for the interaction. - New in version 2.0. - pong¶
- Pongs the interaction when given a ping. - See also - InteractionResponse.pong().
 - channel_message¶
- Responds to the interaction with a message. - See also - InteractionResponse.send_message().
 - deferred_channel_message¶
- Responds to the interaction with a message at a later time. - See also - InteractionResponse.defer().
 - deferred_message_update¶
- Acknowledges the component interaction with a promise that the message will update later (though there is no need to actually update the message). - See also - InteractionResponse.defer().
 - message_update¶
- Responds to the interaction by editing the message. - See also - InteractionResponse.edit_message().
 - application_command_autocomplete_result¶
- Responds to the autocomplete interaction with suggested choices. - See also - InteractionResponse.autocomplete().
 - modal¶
- Responds to the interaction by displaying a modal. - See also - InteractionResponse.send_modal().- New in version 2.4. 
 - Responds to the interaction with a message containing an upgrade button. Only available for applications with monetization enabled. - See also - InteractionResponse.require_premium().- New in version 2.10.