Annotation Interface Modal


@Target(METHOD) @Retention(RUNTIME) public @interface Modal

Methods annotated with Modal will be registered as a modal at startup.

Therefore, the method must be declared inside a class that is annotated with Interaction.

You only define the title via this annotation. The rest of the modal is built when calling ModalReplyableEvent.replyModal(String, ModalTopLevelComponent, Entry...).

Example:

@Modal("My Modal")
public void onModal(ModalEvent event) { ... }

@Command("/example")
public void onCommand(CommandEvent event) {
    event.replyModal("onModal", TextDisplay.of("Hello World"));
}
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Gets the title of this modal.
  • Element Details

    • value

      String value
      Gets the title of this modal.
      Returns:
      the title of the modal