Skip to content

feat(discord): support modals opened from buttons - #1211

Open
codyNog wants to merge 1 commit into
vercel:mainfrom
codyNog:feat/discord-modals
Open

codyNog wants to merge 1 commit into
vercel:mainfrom
codyNog:feat/discord-modals

Conversation

@codyNog

@codyNog codyNog commented Dec 3, 2026 •

Copy link
Copy Markdown

Summary

Closes #1210.

Adds modals to @chat-adapter/discord. A button with actionType="modal" received through HTTP interactions can open a modal with event.openModal(), and submissions reach onModalSubmit. Other buttons keep the immediate deferred response.

  • Opening: the adapter passes onOpenModal to processAction and waits up to 2.5 seconds from receiving the request, because Discord requires a modal as the initial response within 3 seconds. If no modal opens, it responds with DeferredMessageUpdate. The button's custom_id starts with a __m marker, so an action ID of exactly __m with a value is now rejected.
  • Inputs: TextInput and Select each render in a Label. Other children, more than 5 children, and values over Discord's limits throw a ValidationError.
  • Submissions: MODAL_SUBMIT is routed to processModalSubmit under the same deadline. action: "errors" becomes an ephemeral message, sent as a followup after the deadline. Discord can't respond to a submission with a modal, so update and push log a warning and close the modal.
  • Context: the modal's custom_id holds the context ID and callback ID, which limits callbackId to 63 characters. privateMetadata is kept in the state adapter.

There are no changes to chat. The fetch in openModal doesn't run on Discord because the adapter has no fetchMessage, so event.relatedMessage is undefined on submit. File uploads and modals opened from slash commands or Gateway interactions are out of scope.

In #678, DeanMauro mentioned planning modal support. If that work is in progress, I'm happy to coordinate.

Test plan

  • pnpm validate and pnpm konsistent pass.
  • Unit tests cover conversion limits, the deadline on opening and submitting, late and repeated openModal() calls, error messages, and privateMetadata.
  • An integration test opens a modal from a button and delivers its submission through Chat.
  • Not tested against live Discord. In particular, the ephemeral followup after DeferredMessageUpdate is covered only with a mocked API. sample-messages.md is unchanged because no captured payload was available.

Checklist

  • All commits are signed and verified
  • All commits are signed off for the DCO (git commit -s)
  • pnpm validate passes
  • Changeset added (or N/A — see CONTRIBUTING.md)
  • Documentation updated (or N/A)

🤖 Generated with Claude Code

https://claude.ai/code/session_0118w5k7eppSuJdxxj4Fa5hB

Buttons with actionType="modal" received through HTTP interactions can open
a modal with event.openModal(). The adapter waits up to 2.5 seconds for the
handler, then defers. MODAL_SUBMIT interactions reach onModalSubmit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0118w5k7eppSuJdxxj4Fa5hB
Signed-off-by: codynog <yoneyoneyone99@gmail.com>
@codyNog
codyNog requested a review from a team December 3, 2026 21:10
@vercel

vercel Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

@codyNog is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord: support opening modals and handling modal submissions

1 participant