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
A message select menu.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
An option displayed in a select menu.Nested classes/interfaces inherited from class discord4j.core.object.component.MessageComponent
MessageComponent.Type
-
Method Summary
Modifier and TypeMethodDescriptiondisabled()
Creates a new select menu with the same data as this one, but disabled.disabled
(boolean value) Creates a new select menu with the same data as this one, but depending on the value param it may be disabled or not.Returns a set of acceptable channel types the user may select.Gets the select menu's custom id.int
Gets the maximum number of options that must be chosen.int
Gets the minimum number of options that must be chosen.Gets the options that can be selected in the menu.Gets the text displayed if no option is selected.Gets the select menu values, if any.boolean
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 string select menu.static SelectMenu
of
(String customId, List<SelectMenu.Option> options) Creates a string select menu.static SelectMenu
ofChannel
(String customId, Channel.Type... channelTypes) Creates a channel select menu.static SelectMenu
ofChannel
(String customId, List<Channel.Type> channelTypes) Creates a channel select menu.static SelectMenu
ofMentionable
(String customId) Creates a mentionable select menu.static SelectMenu
Creates a role select menu.static SelectMenu
Creates a user select menu.withAllowedChannelTypes
(Channel.Type... types) Creates a new select menu with the same data as this one, but with the given allowed channel types.Creates a new select menu with the same data as this one, but with the given allowed channel types.withMaxValues
(int maxValues) Creates a new select menu with the same data as this one, but with the given maximum values.withMinValues
(int minValues) Creates a new select menu with the same data as this one, but with the given minimum values.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 Details
-
of
Creates a string 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
Creates a string 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.
-
ofRole
Creates a role select menu.- Parameters:
customId
- A developer-defined identifier for the select menu.- Returns:
- A select menu with the given data.
-
ofUser
Creates a user select menu.- Parameters:
customId
- A developer-defined identifier for the select menu.- Returns:
- A select menu with the given data.
-
ofMentionable
Creates a mentionable select menu.- Parameters:
customId
- A developer-defined identifier for the select menu.- Returns:
- A select menu with the given data.
-
ofChannel
Creates a channel select menu.- Parameters:
customId
- A developer-defined identifier for the select menu.channelTypes
- The allowed channel types.- Returns:
- A select menu with the given data.
-
ofChannel
Creates a channel select menu.- Parameters:
customId
- A developer-defined identifier for the select menu.channelTypes
- The allowed channel types.- Returns:
- A select menu with the given data.
-
getCustomId
Gets the select menu's custom id.- Returns:
- The select menu's custom id.
-
getValues
Gets the select menu values, if any. Can be present with an empty list if no value was selected.- Returns:
- the select menu's value
-
getAllowedChannelTypes
Returns a set of acceptable channel types the user may select. Only applies toMessageComponent.Type.SELECT_MENU_CHANNEL
type menus, if empty, no restriction on channel types is placed.- Returns:
- A set of channel types a user may select. Empty set means no restriction is applied.
-
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
Gets the options that can be selected in the menu. List can be empty iftype
of select menu is notMessageComponent.Type.SELECT_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.
-
disabled
Creates a new select menu with the same data as this one, but disabled.- Returns:
- A new disabled select menu with the same data as this one.
-
disabled
Creates a new select menu with the same data as this one, but depending on the value param it may be disabled or not.- Parameters:
value
- True if the select menu should be disabled otherwise False.- Returns:
- A new possibly disabled select menu with the same data as this one.
-
withPlaceholder
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
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
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.
-
withAllowedChannelTypes
Creates a new select menu with the same data as this one, but with the given allowed channel types.- Parameters:
types
- The new allowed channel types.- Returns:
- A new select menu with the given allowed channel types.
-
withAllowedChannelTypes
Creates a new select menu with the same data as this one, but with the given allowed channel types.- Parameters:
types
- The new allowed channel types.- Returns:
- A new select menu with the given allowed channel types.
-