Interface Modal

All Superinterfaces:
SerializableData

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.

Example


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

         TextInput body = TextInput.create("body", TextInputStyle.PARAGRAPH)
                 .setPlaceholder("Your concerns go here")
                 .setMinLength(30)
                 .setMaxLength(1000)
                 .build();

         Modal modal = Modal.create("modmail", "Modmail")
                 .addComponents(Label.of("Subject", subject), Label.of("Body", body))
                 .build();

         event.replyModal(modal).queue();
     }
 }
See Also: