Interface ActionComponent
- All Superinterfaces:
Component
,IDisableable
- All Known Subinterfaces:
Button
,EntitySelectMenu
,SelectMenu
,StringSelectMenu
,TextInput
- All Known Implementing Classes:
ButtonImpl
,EntitySelectMenuImpl
,SelectMenuImpl
,StringSelectMenuImpl
,TextInputImpl
ComponentInteraction
.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.Component
Component.Type
-
Method Summary
Modifier and TypeMethodDescriptiondefault ActionComponent
Returns a copy of this component withisDisabled()
set to true.default ActionComponent
Returns a copy of this component withisDisabled()
set to false.An unique component ID ornull
.default String
getId()
Deprecated.boolean
Whether this action component is disabled.withDisabled
(boolean disabled) Returns a copy of this component withisDisabled()
set to the provided value.withUniqueId
(int uniqueId) Creates a new component with the provided numeric ID.Methods inherited from interface net.dv8tion.jda.api.components.Component
getType, getUniqueId, isMessageCompatible, isModalCompatible
Methods inherited from interface net.dv8tion.jda.api.components.attribute.IDisableable
isEnabled
-
Method Details
-
getId
Deprecated.Replaced withgetCustomId()
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)
.- Returns:
- The component ID or null if not present
- See Also:
-
getCustomId
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)
.- Returns:
- The component ID or null if not present
- See Also:
-
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 interfaceComponent
- Specified by:
withUniqueId
in interfaceIDisableable
- Parameters:
uniqueId
- The new ID; must be higher or equal to 1- Returns:
- The new component
-
isDisabled
boolean isDisabled()Whether this action component is disabled.You can use
asDisabled()
orasEnabled()
to create enabled/disabled instances.- Specified by:
isDisabled
in interfaceIDisableable
- Returns:
- True, if this button is disabled
-
asDisabled
Returns a copy of this component withisDisabled()
set to true.- Specified by:
asDisabled
in interfaceIDisableable
- Returns:
- New disabled component instance
- See Also:
-
asEnabled
Returns a copy of this component withisDisabled()
set to false.- Specified by:
asEnabled
in interfaceIDisableable
- Returns:
- New enabled component instance
- See Also:
-
withDisabled
Returns a copy of this component withisDisabled()
set to the provided value.- Specified by:
withDisabled
in interfaceIDisableable
- Parameters:
disabled
- True, if this component should be disabled- Returns:
- New enabled/disabled component instance
- Throws:
UnsupportedOperationException
- If this component type cannot be disabled- See Also:
-
getCustomId()