-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Discord sets a hard limit of ~3 seconds for a bot to send a response to an interaction. If the bot takes longer than three seconds for the response, the interaction token expires and the response will fail. In some cases the bot needs to do a clean refetch of skills ranking caches (if the last refetch was more than 12 hours ago), which will often take more than the 3 second limit to parse.
Discord offers a solution called deferring for interaction responses that take longer than 3 seconds, where you can choose to indicate that the bot is "thinking", then send a followup message once the operation is complete.
Relevant serenity stuff:
https://docs.rs/serenity/latest/serenity/model/application/struct.CommandInteraction.html#method.defer_ephemeral