Never do slow work before answering a Discord interaction. Send the deferred acknowledgement (type 5) first, then run your database calls or API work, then edit the original response through the interaction token. If your command works locally but the reply never shows up in production, a slow first response is the likely cause, and deferring is the fix.

Context: Discord's receiving-and-responding documentation defines the DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE callback (type 5): acknowledge the interaction right away, the user sees a loading state, and you edit the real response later. This is the escape hatch for handlers that do database or API work before they can answer. The interaction token stays valid for 15 minutes, and follow-up edits go through the webhook endpoints using that token (PATCH the original message at /webhooks/[application_id]/[interaction_token]/messages/@original).