feat: Discord slash command handling via HTTP interactions#151
feat: Discord slash command handling via HTTP interactions#151cipher416 wants to merge 5 commits intovercel:mainfrom
Conversation
|
@cipher416 is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
|
closing this as this is a duplicate of this PR: |
You didn't have to close :) We could have just waited and seen what the maintainers preferred! |
No worries! After reviewing your implementation I realized the AsyncLocalStorage approach is fundamentally better than what I had (storing the interaction token in shared state with a TTL key):
One thing I noticed while testing: file attachment responses also need to go through the interaction webhook path |
Problem
Discord slash command interactions (
APPLICATION_COMMAND) were acknowledged but never forwarded toonSlashCommand, so handlers were never invoked when using HTTP Interactions in the Discord adapter (#131).Solution
Handle
APPLICATION_COMMANDinteractions by constructing a slash command event and callingprocessSlashCommand. Persist the interaction token in state so deferred responses can be patched via the interaction webhook, then fall back to normal channel messaging if needed.Changes
handleSlashCommandInteractionto validate inputs, build the event, store the interaction token, and invokeprocessSlashCommand.Testing
Verified end-to-end with a real Discord bot + ngrok tunnel —
/helpand/echoboth fire handlers and resolve the deferred "thinking" response.2026-03-02.14-21-24.mp4
Responses with file attachments:
2026-03-02.15-06-37.mp4