Open fuma-nama opened 2 years ago
Did you manage to send a Modal that contains a SelectMenu
with JDA?
Putting them in Modals is not yet officially released nor documented.
Select menus aren't officially supported by Discord, once it's documentation is published JDA will implement it
Are you still experiencing the issue? I wanted to add a StringSelectMenu to a Modal in the same way, but according to the official documentation (https://jda.wiki/using-jda/interactions/#modals), ''Similarly to messages, Modals can contain up to 5 ActionRows, although the only component that can be put inside Modals at the moment (TextInput) takes up a whole ActionRow.'' This means that only TextInput can be added to modals.
Therefore, I solved this by modifying the process to reply to the interaction with event.reply().addActionRow() upon submitting the modal through onModalInteraction. I added a Button to addActionRow() and used the button interaction to generate a StringSelectMenu. Additionally, if multiple threads access and modify objects during the process, you might want to add measures to handle this.
Are you still experiencing the issue? I wanted to add a StringSelectMenu to a Modal in the same way, but according to the official documentation (https://jda.wiki/using-jda/interactions/#modals), ''Similarly to messages, Modals can contain up to 5 ActionRows, although the only component that can be put inside Modals at the moment (TextInput) takes up a whole ActionRow.'' This means that only TextInput can be added to modals.
Therefore, I solved this by modifying the process to reply to the interaction with event.reply().addActionRow() upon submitting the modal through onModalInteraction. I added a Button to addActionRow() and used the button interaction to generate a StringSelectMenu. Additionally, if multiple threads access and modify objects during the process, you might want to add measures to handle this.
Modals can have only TextInput's. This issue and related PR exist because discord enabled selects in modals by accident
General Troubleshooting
Expected Behaviour
TextInput and Modal are added in alpha 11, now Discord API also allows SelectMenu to be used in Modal. However, JDA failed to parse data when SelectMenu is used in Modal.
The exception is throwed outside the
onModalInteraction(ModalInteractionEvent event)
methodException or Error