Interface EntitySelectMenu

All Superinterfaces:
ActionComponent, Component, ItemComponent, SelectMenu, SerializableData

public interface EntitySelectMenu extends SelectMenu
Specialized SelectMenu for selecting Discord entities.

Unlike StringSelectMenu, these entity select menus do not support custom choices. A user will get suggested inputs based on what they write into the select menu.

This is an interactive component and usually located within an ActionRow. One select menu fills up an entire action row by itself. You cannot have an action row with other components if a select menu is present in the same row.

The selections a user makes are only visible within their current client session. Other users cannot see the choices selected, and they will disappear when the client restarts or the message is reloaded.

Examples


 public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
   if (!event.getName().equals("class")) return;

   EntitySelectMenu menu = EntitySelectMenu.create("menu:class", SelectTarget.ROLE)
     .setPlaceholder("Choose your class") // shows the placeholder indicating what this menu is for
     .setRequiredRange(1, 1) // must select exactly one
     .build();

   event.reply("Please pick your class below")
     .setEphemeral(true)
     .addActionRow(menu)
     .queue();
 }
 
See Also: