Interface SelectMenu
- All Superinterfaces:
ActionComponent
,Component
,ItemComponent
,SerializableData
- All Known Subinterfaces:
EntitySelectMenu
,StringSelectMenu
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.
This is a generic interface for all types of select menus.
You can use EntitySelectMenu.create(String, Collection)
to create a select menu of Discord entities such as users
.
Alternatively, you can use StringSelectMenu.create(String)
to create a select menu of up to 25 pre-defined strings to pick from.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
SelectMenu.Builder<T extends SelectMenu,
B extends SelectMenu.Builder<T, B>> A preconfigured builder for the creation of select menus.Nested classes/interfaces inherited from interface net.dv8tion.jda.api.interactions.components.Component
Component.Type
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximum length a select menu id can havestatic final int
The maximum amount of options a select menu can havestatic final int
The maximum length a select menu placeholder can have -
Method Summary
Modifier and TypeMethodDescriptionSelectMenu.Builder<? extends SelectMenu,
? extends SelectMenu.Builder<?, ?>> Creates a new preconfiguredSelectMenu.Builder
with the same settings used for this select menu.int
The maximum amount of values a user can select at once.int
The minimum amount of values a user has to select.Placeholder which is displayed when no selections have been made yet.Methods inherited from interface net.dv8tion.jda.api.interactions.components.ActionComponent
asDisabled, asEnabled, getId, isDisabled, withDisabled
Methods inherited from interface net.dv8tion.jda.api.interactions.components.ItemComponent
getMaxPerRow, isMessageCompatible, isModalCompatible
Methods inherited from interface net.dv8tion.jda.api.utils.data.SerializableData
toData
-
Field Details
-
ID_MAX_LENGTH
static final int ID_MAX_LENGTHThe maximum length a select menu id can have- See Also:
-
PLACEHOLDER_MAX_LENGTH
static final int PLACEHOLDER_MAX_LENGTHThe maximum length a select menu placeholder can have- See Also:
-
OPTIONS_MAX_AMOUNT
static final int OPTIONS_MAX_AMOUNTThe maximum amount of options a select menu can have- See Also:
-
-
Method Details
-
getPlaceholder
Placeholder which is displayed when no selections have been made yet.- Returns:
- The placeholder or null
-
getMinValues
int getMinValues()The minimum amount of values a user has to select.- Returns:
- The min values
-
getMaxValues
int getMaxValues()The maximum amount of values a user can select at once.- Returns:
- The max values
-
createCopy
@Nonnull @CheckReturnValue SelectMenu.Builder<? extends SelectMenu,? extends SelectMenu.Builder<?, createCopy()?>> Creates a new preconfiguredSelectMenu.Builder
with 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.- Returns:
- The
SelectMenu.Builder
used to create the select menu
-