Skip to content

Defer messages for request-heavy reponses. #10

@tropicaaal

Description

@tropicaaal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions