Interface StringSelectMenu

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

public interface StringSelectMenu extends SelectMenu
Represents a select menu in a message.
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;

   StringSelectMenu menu = StringSelectMenu.create("menu:class")
     .setPlaceholder("Choose your class") // shows the placeholder indicating what this menu is for
     .setRequiredRange(1, 1) // exactly one must be selected
     .addOption("Arcane Mage", "mage-arcane")
     .addOption("Fire Mage", "mage-fire")
     .addOption("Frost Mage", "mage-frost")
     .setDefaultValues("mage-fire") // default to fire mage
     .build();

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