Interface SelectionMenu

  • All Superinterfaces:
    Component, SerializableData

    public interface SelectionMenu
    extends Component
    Represents a selection menu in a message.
    This is an interactive component and usually located within an ActionRow. One selection menu fills up an entire action row by itself. You cannot have an action row with other components if a selection 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 onSlashCommand(SlashCommandEvent event) {
       if (!event.getName().equals("class")) return;
    
       SelectionMenu menu = SelectionMenu.create("menu:class")
         .setPlaceholder("Choose your class") // shows the placeholder indicating what this menu is for
         .setRequireRange(1, 1) // only one can be selected
         .addOption("Arcane Mage", "mage-arcane")
         .addOption("Fire Mage", "mage-fire")
         .addOption("Frost Mage", "mage-frost")
         .build();
    
       event.reply("Please pick your class below")
         .setEphemeral(true)
         .addActionRow(menu)
         .queue();
     }