Interface StringSelectMenu
- All Superinterfaces:
- ActionComponent,- Component,- ItemComponent,- SelectMenu,- SerializableData
Represents a select menu in a message.
 
This is an interactive component and usually located within an
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:
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classA preconfigured builder for the creation of string select menus.Nested classes/interfaces inherited from interface net.dv8tion.jda.api.interactions.components.ComponentComponent.Type
- 
Field SummaryFields inherited from interface net.dv8tion.jda.api.interactions.components.selections.SelectMenuID_MAX_LENGTH, OPTIONS_MAX_AMOUNT, PLACEHOLDER_MAX_LENGTH
- 
Method SummaryModifier and TypeMethodDescriptiondefault StringSelectMenuReturns a copy of this component withActionComponent.isDisabled()set to true.default StringSelectMenuReturns a copy of this component withActionComponent.isDisabled()set to false.static StringSelectMenu.BuilderCreates a newStringSelectMenu.Builderfor a select menu with the provided custom id.default StringSelectMenu.BuilderCreates a new preconfiguredStringSelectMenu.Builderwith the same settings used for this select menu.An unmodifiable list of up to 25 available options to choose from.default StringSelectMenuwithDisabled(boolean disabled) Returns a copy of this component withActionComponent.isDisabled()set to the provided value.Methods inherited from interface net.dv8tion.jda.api.interactions.components.ActionComponentgetId, isDisabledMethods inherited from interface net.dv8tion.jda.api.interactions.components.ItemComponentgetMaxPerRow, isMessageCompatible, isModalCompatibleMethods inherited from interface net.dv8tion.jda.api.interactions.components.selections.SelectMenugetMaxValues, getMinValues, getPlaceholderMethods inherited from interface net.dv8tion.jda.api.utils.data.SerializableDatatoData
- 
Method Details- 
asDisabledDescription copied from interface:ActionComponentReturns a copy of this component withActionComponent.isDisabled()set to true.- Specified by:
- asDisabledin interface- ActionComponent
- Returns:
- New disabled component instance
 
- 
asEnabledDescription copied from interface:ActionComponentReturns a copy of this component withActionComponent.isDisabled()set to false.- Specified by:
- asEnabledin interface- ActionComponent
- Returns:
- New enabled component instance
 
- 
withDisabledDescription copied from interface:ActionComponentReturns a copy of this component withActionComponent.isDisabled()set to the provided value.- Specified by:
- withDisabledin interface- ActionComponent
- Parameters:
- disabled- True, if this component should be disabled
- Returns:
- New enabled/disabled component instance
 
- 
getOptionsAn unmodifiable list of up to 25 available options to choose from.- Returns:
- The SelectOptionsthis menu provides
- See Also:
 
- 
createCopyCreates a new preconfiguredStringSelectMenu.Builderwith the same settings used for this select menu.
 This can be useful to create an updated version of this menu without needing to rebuild it from scratch.- Specified by:
- createCopyin interface- SelectMenu
- Returns:
- The StringSelectMenu.Builderused to create the select menu
 
- 
createCreates a newStringSelectMenu.Builderfor a select menu with the provided custom id.- Parameters:
- customId- The id used to identify this menu with- ActionComponent.getId()for component interactions
- Returns:
- The StringSelectMenu.Builderused to create the select menu
- Throws:
- IllegalArgumentException- If the provided id is null, empty, or longer than 100 characters
 
 
-