Package discord4j.core.object.component
Class SelectMenu
- java.lang.Object
-
- discord4j.core.object.component.MessageComponent
-
- discord4j.core.object.component.ActionComponent
-
- discord4j.core.object.component.SelectMenu
-
public class SelectMenu extends ActionComponent
A message select menu.- See Also:
- Select Menus
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SelectMenu.Option
An option displayed in a select menu.-
Nested classes/interfaces inherited from class discord4j.core.object.component.MessageComponent
MessageComponent.Type
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCustomId()
Gets the select menu's custom id.int
getMaxValues()
Gets the maximum number of options that must be chosen.int
getMinValues()
Gets the minimum number of options that must be chosen.List<SelectMenu.Option>
getOptions()
Gets the options that can be selected in the menu.Optional<String>
getPlaceholder()
Gets the text displayed if no option is selected.boolean
isDisabled()
Gets whether the select menu is disabled (i.e., the user is prevented from selecting any options).static SelectMenu
of(String customId, SelectMenu.Option... options)
Creates a select menu.static SelectMenu
of(String customId, List<SelectMenu.Option> options)
Creates a select menu.SelectMenu
withMaxValues(int maxValues)
Creates a new select menu with the same data as this one, but with the given maximum values.SelectMenu
withMinValues(int minValues)
Creates a new select menu with the same data as this one, but with the given minimum values.SelectMenu
withPlaceholder(String placeholder)
Creates a new select menu with the same data as this one, but with the given placeholder text.-
Methods inherited from class discord4j.core.object.component.MessageComponent
fromData, getData, getType
-
-
-
-
Method Detail
-
of
public static SelectMenu of(String customId, SelectMenu.Option... options)
Creates a select menu.- Parameters:
customId
- A developer-defined identifier for the select menu.options
- The options that can be selected in the menu.- Returns:
- A select menu with the given data.
-
of
public static SelectMenu of(String customId, List<SelectMenu.Option> options)
Creates a select menu.- Parameters:
customId
- A developer-defined identifier for the select menu.options
- The options that can be selected in the menu.- Returns:
- A select menu with the given data.
-
getCustomId
public String getCustomId()
Gets the select menu's custom id.- Returns:
- The select menu's custom id.
-
getPlaceholder
public Optional<String> getPlaceholder()
Gets the text displayed if no option is selected.- Returns:
- The text displayed if no option is selected.
-
getMinValues
public int getMinValues()
Gets the minimum number of options that must be chosen.- Returns:
- The minimum number of options that must be chosen.
-
getMaxValues
public int getMaxValues()
Gets the maximum number of options that must be chosen.- Returns:
- The maximum number of options that must be chosen.
-
getOptions
public List<SelectMenu.Option> getOptions()
Gets the options that can be selected in the menu.- Returns:
- The options that can be selected in the menu.
-
isDisabled
public boolean isDisabled()
Gets whether the select menu is disabled (i.e., the user is prevented from selecting any options).- Returns:
- Whether the select menu is disabled.
-
withPlaceholder
public SelectMenu withPlaceholder(String placeholder)
Creates a new select menu with the same data as this one, but with the given placeholder text.- Parameters:
placeholder
- The new placeholder text.- Returns:
- A new select menu with the given placeholder text.
-
withMinValues
public SelectMenu withMinValues(int minValues)
Creates a new select menu with the same data as this one, but with the given minimum values.- Parameters:
minValues
- The new minimum values.- Returns:
- A new select menu with the given minimum values.
-
withMaxValues
public SelectMenu withMaxValues(int maxValues)
Creates a new select menu with the same data as this one, but with the given maximum values.- Parameters:
maxValues
- The new maximum values.- Returns:
- A new select menu with the given maximum values.
-
-