Interface Modal

All Superinterfaces:

public interface Modal extends SerializableData
Represents a Discord Modal

Replying to an interaction with a modal will open an interactive popout on the User's Discord client. This is similar to the ban modal where you can input a ban reason.


 public void onSlashCommandInteraction(@Nonnull SlashCommandInteractionEvent event)
     if (event.getName().equals("modmail"))
         TextInput subject = TextInput.create("subject", "Subject", TextInputStyle.SHORT)
                 .setPlaceholder("Subject of this ticket")
                 .setMaxLength(100) // or setRequiredRange(10, 100)

         TextInput body = TextInput.create("body", "Body", TextInputStyle.PARAGRAPH)
                 .setPlaceholder("Your concerns go here")

         Modal modal = Modal.create("modmail", "Modmail")
                 .addComponents(ActionRow.of(subject), ActionRow.of(body))


Only a maximum of 5 component layouts can be included in a Modal, and only TextInputs are allowed at this time. You can check whether a component is supported via Component.Type.isModalCompatible().

See Also: