Interface ActionComponent
- All Superinterfaces:
Component
,ItemComponent
,SerializableData
- All Known Subinterfaces:
Button
,EntitySelectMenu
,SelectMenu
,StringSelectMenu
,TextInput
Component which supports interactions via
ComponentInteraction
.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.interactions.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.getId()
The component ID or null.boolean
Whether this action component is disabled.withDisabled
(boolean disabled) Returns a copy of this component withisDisabled()
set to the provided value.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
-
Method Details
-
getId
The component ID or null.
Some components such as link buttons don't have this.This need not be a numeric ID! All these component IDs are custom and user-provided data, unlike other IDs generated by Discord. This ID is used for event handling with
ComponentInteraction.getComponentId()
.- Returns:
- The component ID or null if not present
- See Also:
-
isDisabled
boolean isDisabled()Whether this action component is disabled.You can use
asDisabled()
orasEnabled()
to create enabled/disabled instances.- Returns:
- True, if this button is disabled
-
asDisabled
Returns a copy of this component withisDisabled()
set to true.- Returns:
- New disabled component instance
-
asEnabled
Returns a copy of this component withisDisabled()
set to false.- Returns:
- New enabled component instance
-
withDisabled
Returns a copy of this component withisDisabled()
set to the provided value.- Parameters:
disabled
- True, if this component should be disabled- Returns:
- New enabled/disabled component instance
- Throws:
UnsupportedOperationException
- If this component type cannot be disabled
-