| 1 |
\page modal-dialog-interactions Modals |
| 2 |
|
| 3 |
Modal dialog interactions are a new Discord API feature that allow you to have pop-up windows which prompt the user to input information. Once the user has filled in this information, your program will receive an `on_form_submit` event which will contain the data which was input. You must use a slash command interaction response to submit your modal form data to Discord, via the `on_slashcommand` event. From here calling the `dialog` method of the `interaction_create_t` event object will trigger the dialog to appear. |
| 4 |
|
| 5 |
Each dialog box may have up to five rows of input fields. The example below demonstrates a simple setup with just one text input: |
| 6 |
|
| 7 |
\include{cpp} modal_dialog_interactions.cpp |
| 8 |
|
| 9 |
If you compile and run this program and wait for the global command to register, typing `/dialog` will present you with a dialog box like the one below: |
| 10 |
|
| 11 |
\image html modal_dialog.png |
| 12 |
|