Interface ActionComponent
-
- All Superinterfaces:
Component
,ItemComponent
,SerializableData
- All Known Subinterfaces:
Button
,SelectMenu
public interface ActionComponent extends ItemComponent
Component which supports interactions viaComponentInteraction
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.interactions.components.Component
Component.Type
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ActionComponent
asDisabled()
Returns a copy of this component withisDisabled()
set to true.default ActionComponent
asEnabled()
Returns a copy of this component withisDisabled()
set to false.String
getId()
The component ID or null.boolean
isDisabled()
Whether this action component is disabled.ActionComponent
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
-
Methods inherited from interface net.dv8tion.jda.api.utils.data.SerializableData
toData
-
-
-
-
Method Detail
-
getId
@Nullable String 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:
ComponentInteraction.getComponentId()
-
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
@Nonnull @CheckReturnValue default ActionComponent asDisabled()
Returns a copy of this component withisDisabled()
set to true.- Returns:
- New disabled component instance
-
asEnabled
@Nonnull @CheckReturnValue default ActionComponent asEnabled()
Returns a copy of this component withisDisabled()
set to false.- Returns:
- New enabled component instance
-
withDisabled
@Nonnull @CheckReturnValue ActionComponent withDisabled(boolean disabled)
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
-
-