Class SelectMenuImpl
java.lang.Object
net.dv8tion.jda.internal.components.AbstractComponentImpl
net.dv8tion.jda.internal.components.selections.SelectMenuImpl
- All Implemented Interfaces:
ActionComponent
,ActionRowChildComponent
,ActionRowChildComponentUnion
,IDisableable
,Component
,IComponentUnion
,SelectMenu
,SerializableData
- Direct Known Subclasses:
EntitySelectMenuImpl
,StringSelectMenuImpl
public abstract class SelectMenuImpl
extends AbstractComponentImpl
implements SelectMenu, ActionRowChildComponentUnion
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.Component
Component.Type
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.selections.SelectMenu
SelectMenu.Builder<T extends SelectMenu,
B extends SelectMenu.Builder<T, B>> -
Field Summary
Fields inherited from interface net.dv8tion.jda.api.components.selections.SelectMenu
ID_MAX_LENGTH, OPTIONS_MAX_AMOUNT, PLACEHOLDER_MAX_LENGTH
-
Constructor Summary
ConstructorsConstructorDescriptionSelectMenuImpl
(String id, int uniqueId, String placeholder, int minValues, int maxValues, boolean disabled) SelectMenuImpl
(DataObject data) -
Method Summary
Modifier and TypeMethodDescriptionAn unique component ID ornull
.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.int
The unique, numeric identifier of this component.boolean
Whether this action component is disabled.toData()
SerializedDataObject
for this object.toString()
abstract SelectMenuImpl
withUniqueId
(int uniqueId) Creates a new component with the provided numeric ID.Methods inherited from class net.dv8tion.jda.internal.components.AbstractComponentImpl
asActionRow, asButton, asContainer, asEntitySelectMenu, asFileDisplay, asMediaGallery, asSection, asSeparator, asStringSelectMenu, asTextDisplay, asTextInput, asThumbnail
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.dv8tion.jda.api.components.ActionComponent
getId
Methods inherited from interface net.dv8tion.jda.api.components.actionrow.ActionRowChildComponentUnion
asButton, asEntitySelectMenu, asStringSelectMenu
Methods inherited from interface net.dv8tion.jda.api.components.Component
getType, isMessageCompatible, isModalCompatible
Methods inherited from interface net.dv8tion.jda.api.components.IComponentUnion
isUnknownComponent
Methods inherited from interface net.dv8tion.jda.api.components.attribute.IDisableable
isEnabled
Methods inherited from interface net.dv8tion.jda.api.components.selections.SelectMenu
asDisabled, asEnabled, createCopy, withDisabled
-
Constructor Details
-
SelectMenuImpl
-
SelectMenuImpl
-
-
Method Details
-
withUniqueId
Description copied from interface:Component
Creates a new component with the provided numeric ID.
If no ID is set, Discord will generate IDs incrementally starting from 1 and will not use existing IDs from the same message/modal.- Specified by:
withUniqueId
in interfaceActionComponent
- Specified by:
withUniqueId
in interfaceActionRowChildComponent
- Specified by:
withUniqueId
in interfaceActionRowChildComponentUnion
- Specified by:
withUniqueId
in interfaceComponent
- Specified by:
withUniqueId
in interfaceIComponentUnion
- Specified by:
withUniqueId
in interfaceIDisableable
- Specified by:
withUniqueId
in interfaceSelectMenu
- Parameters:
uniqueId
- The new ID; must be higher or equal to 1- Returns:
- The new component
-
getCustomId
Description copied from interface:ActionComponent
An unique component ID ornull
.
Some components such as link buttons don't have this.Custom IDs can contain custom data, this is typically used to pass data between a slash command and your button listener.
While this ID is unique and can be retrieved with
ComponentInteraction.getComponentId()
, you should useComponent.getUniqueId()
to identify a component in a single message, such as when replacing components usingComponentTree
orIReplaceable.replace(ComponentReplacer)
.- Specified by:
getCustomId
in interfaceActionComponent
- Specified by:
getCustomId
in interfaceSelectMenu
- Returns:
- The component ID or null if not present
- See Also:
-
getUniqueId
public int getUniqueId()Description copied from interface:Component
The unique, numeric identifier of this component.
Can be set manually or automatically assigned by Discord (starting from1
). If it has not been assigned yet, this will return-1
.Note: Older messages may return
0
.- Specified by:
getUniqueId
in interfaceComponent
- Returns:
- The unique identifier of this component, or
-1
if not assigned yet, or0
on older messages
-
getPlaceholder
Description copied from interface:SelectMenu
Placeholder which is displayed when no selections have been made yet.- Specified by:
getPlaceholder
in interfaceSelectMenu
- Returns:
- The placeholder or null
-
getMinValues
public int getMinValues()Description copied from interface:SelectMenu
The minimum amount of values a user has to select.- Specified by:
getMinValues
in interfaceSelectMenu
- Returns:
- The min values
-
getMaxValues
public int getMaxValues()Description copied from interface:SelectMenu
The maximum amount of values a user can select at once.- Specified by:
getMaxValues
in interfaceSelectMenu
- Returns:
- The max values
-
isDisabled
public boolean isDisabled()Description copied from interface:ActionComponent
Whether this action component is disabled.You can use
ActionComponent.asDisabled()
orActionComponent.asEnabled()
to create enabled/disabled instances.- Specified by:
isDisabled
in interfaceActionComponent
- Specified by:
isDisabled
in interfaceIDisableable
- Returns:
- True, if this button is disabled
-
toData
Description copied from interface:SerializableData
SerializedDataObject
for this object.- Specified by:
toData
in interfaceSerializableData
- Returns:
DataObject
-
toString
-