The defer response, defers the interaction response. This is typically used when the interaction is acknowledged and an optional secondary action will be done later. When deferring, you get up to 15 minutes to respond instead of the normal 3 seconds.
This response is only supported if the interaction is an application command, component/view, or a modal.
Because deferring counts as a response, your can't use the typical InteractionResponse
methods. Here are a list of substitutions that you can use.
InteractionResponse.send_message
InteractionResponse.edit_message
InteractionResponse.send_modal
InteractionResponse.defer
- Delete
To send a message after the initial response, we can send a followup via Interaction.followup
. This returns a Webhook
, so we can use Webhook.send
to send a message.
Example:
await interaction.followup.send(...)
also, unlike response.send_message
, followup.send
DOES return the message object (if you set wait
to True
)
Note: when deferring in an app_command or modal, your first followup will respect the ephemeral setting set when deferring, and all other followups will be independent
To edit the initial response, we can use Interaction.edit_original_response
.
Note: If the response was defer, you set
thinking
toFalse
, and the interaction came from a component, this will edit the message the component is on.
To delete the initial response, we can use delete_original_response
.
Note: If the response was defer, you set
thinking
toFalse
, and the interaction came from a component, this will delete the message the component is on.
Sending a modal can only be done via the response. If you need more than 3 seconds to prepare a modal, consider sending a button that lets your user open the modal after preparing it.
15 minutes is the max amount of time that you can get. You can not defer a second time for another 15 minutes.