Discord: a command that answers with a form does nothing #116

Closed
opened 2026-09-06 12:04:26 -04:00 by Salastil · 1 comment
Owner

#105 taught moho to run slash commands and press the buttons a message carries. There
is a third answer Discord can give to a command, and it is the one that goes nowhere:
an interaction modal - a small form the server asks you to fill in and submit.

INTERACTION_MODAL_CREATE is not handled. There is not a single occurrence of "modal"
in nobilis/src/backend/discord.rs, so a command that answers with one is a command
that appears to do nothing at all: no form, no error, no line in the log. The commands
that do this are ordinary ones - a bot asking for a title and a description, a report
form, an application.

What is needed

  • Handle the INTERACTION_MODAL_CREATE dispatch and carry its component tree to the
    client, the way note_components already does for message components
    (extract_components, backend/discord.rs).
  • A dialog in the renderer built from that tree: text inputs, short and paragraph,
    with the labels and placeholders the server sent.
  • Submit as interaction type 5 (MODAL_SUBMIT) through the same /interactions path
    run_command and use_component already use.

Done looks like: a command that opens a form opens a form here, and submitting it
gets the same answer the official client gets.

Reference: the official Discord client. Follows #105.

#105 taught moho to run slash commands and press the buttons a message carries. There is a third answer Discord can give to a command, and it is the one that goes nowhere: an **interaction modal** - a small form the server asks you to fill in and submit. `INTERACTION_MODAL_CREATE` is not handled. There is not a single occurrence of "modal" in `nobilis/src/backend/discord.rs`, so a command that answers with one is a command that appears to do nothing at all: no form, no error, no line in the log. The commands that do this are ordinary ones - a bot asking for a title and a description, a report form, an application. **What is needed** - Handle the `INTERACTION_MODAL_CREATE` dispatch and carry its component tree to the client, the way `note_components` already does for message components (`extract_components`, `backend/discord.rs`). - A dialog in the renderer built from that tree: text inputs, short and paragraph, with the labels and placeholders the server sent. - Submit as interaction type 5 (`MODAL_SUBMIT`) through the same `/interactions` path `run_command` and `use_component` already use. **Done looks like:** a command that opens a form opens a form here, and submitting it gets the same answer the official client gets. Reference: the official Discord client. Follows #105.
Salastil added the bugprotocol labels 2026-09-06 12:04:26 -04:00
Salastil removed the protocol label 2026-09-06 12:49:13 -04:00
Author
Owner

Finished.

Handled in nobilis 2aee7a2, with the dialog in moho 6ea68c3.

INTERACTION_MODAL_CREATE is read in the gateway dispatch and its component tree carried to the client. The fields arrive as the bot described them - which are a single line and which are a paragraph, which may be left empty, and how long each may be - so the form the renderer draws is the bot's form and not a generic box. Submitting goes back through the same /interactions path run_command and use_component already use, as interaction type 5.

A command that answers with a form now opens one.

Finished. Handled in nobilis [2aee7a2](https://git.salastil.com/Salastil/nobilis/commit/2aee7a23bf59b2b27a624312b45f1c27ce5e0c1a), with the dialog in moho [6ea68c3](https://git.salastil.com/Salastil/moho/commit/6ea68c3). `INTERACTION_MODAL_CREATE` is read in the gateway dispatch and its component tree carried to the client. The fields arrive as the bot described them - which are a single line and which are a paragraph, which may be left empty, and how long each may be - so the form the renderer draws is the bot's form and not a generic box. Submitting goes back through the same `/interactions` path `run_command` and `use_component` already use, as interaction type 5. A command that answers with a form now opens one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Salastil/moho#116