Modals
Video Tutorial
This video Tutorial goes over how to use modals in inventor.
Written Tutorial
Modal Tutorial
This guide will walk you through creating a modal system in Discord with commands and flows. We’ll cover how to call a modal, handle its submission, and send data with modals. Follow along step-by-step to build your bot.
1. Calling the Modal
- Create the Flow
Name the flow My Modal.
Set the trigger to Slash Command.
Name the command modal and sync it.
×
- Add a Modal Reply to Interaction Block
- Configure the block as follows:
Modal Name: Nickname
Custom ID: mymodal (remember this ID; it will be used later)
Field Label: Nickname
Required: True
Field Type: Large Field
××
- Configure the block as follows:
Your calling flow is now complete. This flow triggers the modal.
2. Modal Submission Flow
- Create the Flow
Name the flow My Modal Submission.
Set the trigger to Modal Submit.
Use the Custom Modal ID from before: mymodal.
×
- Add an Embed Reply to Interaction Block
- Configure the block as follows:
- Description:
Write: Nickname:
Add the variable Modal Field 1 Value from the Modal Submit block.
×
- Description:
- Configure the block as follows:
Now, when the modal is submitted, the bot will respond with an embed containing the entered nickname.
- Test the Command
Run the
/modal
command in Discord.The modal should appear with a field labeled Nickname.
×
- Submit the Modal
- After submitting, the bot should respond with an embed containing:
Nickname: (value you entered)
×
- After submitting, the bot should respond with an embed containing:
3. Sending Data with Modals
This section explains how to pass data dynamically using the modal ID.
- Modify the Slash Command Flow
- Add a Get Current Date and Time Block before the Modal Reply to Interaction Block.
Configure it to output the current time in HH:MM:SS format.
×
- Edit the Modal Custom ID in the Modal Reply to Interaction block:
Set it to mymodal- and append the current time variable.
×
- Add a Get Current Date and Time Block before the Modal Reply to Interaction Block.
- Edit the Modal Submit Flow
Change the Modal Custom ID to mymodal-*.
×Add a String Trim Prefix Block before the Embed Reply to Interaction block:
String: Use the Modal ID from the Modal Submit block.
Prefix: Set it to mymodal-.
×
Update the Embed Reply to Interaction Block:
Add the current time (from the String Trim Prefix block) to the Footer Text.
×
4. Testing the Modal
- Test the Command
Run the
/modal
command in Discord.The modal should appear with a field labeled Nickname.
×
- Submit the Modal
- After submitting, the bot should respond with an embed containing:
Nickname: (value you entered)
Footer: Showing the time.
×
- After submitting, the bot should respond with an embed containing:
- Test Multiple Times
Run the command twice, ensuring the seconds in the footer are different.
×
With this setup, you’ve created a dynamic modal system that includes timestamped data! This can be expanded further for advanced interactions.