Interface Section
- All Superinterfaces:
Component
,ContainerChildComponent
,IDisableable
,IReplaceable
,MessageTopLevelComponent
- All Known Implementing Classes:
SectionImpl
public interface Section
extends MessageTopLevelComponent, ContainerChildComponent, IReplaceable, IDisableable
Component which contains the main content on the left and an accessory on the right.
This can contain up to 3 SectionContentComponent
.
Requirements: Components V2 needs to be enabled!
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.Component
Component.Type
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
How manySectionContentComponent
can be in this section. -
Method Summary
Modifier and TypeMethodDescriptiondefault Section
Returns a new instance of this component in a disabled state.default Section
Returns a new instance of this component in an enabled state.The accessory of this section.@Unmodifiable List
<SectionContentComponentUnion> Returns an immutable list with the components contained by this section.default boolean
Whether this component is disabled.default boolean
Whether this component is enabled.default boolean
Whether this Component is compatible withMessages
.default boolean
Whether this Component is compatible withModals
.static Section
of
(SectionAccessoryComponent accessory, Collection<? extends SectionContentComponent> components) Constructs a newSection
from the given accessory and components.static Section
of
(SectionAccessoryComponent accessory, SectionContentComponent component, SectionContentComponent... components) Constructs a newSection
from the given accessory and components.replace
(ComponentReplacer replacer) Replaces and/or removes children components using the providedComponentReplacer
, and construct a new component from the result.default Section
withDisabled
(boolean disabled) Returns a new instance of this component in an enabled/disabled state.withUniqueId
(int uniqueId) Creates a new component with the provided numeric ID.Methods inherited from interface net.dv8tion.jda.api.components.Component
getType, getUniqueId
-
Field Details
-
MAX_COMPONENTS
static final int MAX_COMPONENTSHow manySectionContentComponent
can be in this section. (3)- See Also:
-
-
Method Details
-
of
@Nonnull static Section of(@Nonnull SectionAccessoryComponent accessory, @Nonnull Collection<? extends SectionContentComponent> components) Constructs a newSection
from the given accessory and components.- Parameters:
accessory
- The accessory of this sectioncomponents
- The components to add- Returns:
- The new
Section
- Throws:
IllegalArgumentException
-
-
of
@Nonnull static Section of(@Nonnull SectionAccessoryComponent accessory, @Nonnull SectionContentComponent component, @Nonnull SectionContentComponent... components) Constructs a newSection
from the given accessory and components.- Parameters:
accessory
- The accessory of this sectioncomponent
- The component to addcomponents
- Additional components to add- Returns:
- The new
Section
- Throws:
IllegalArgumentException
-
-
isMessageCompatible
default boolean isMessageCompatible()Description copied from interface:Component
Whether this Component is compatible withMessages
.
If the component in question contains other components, this also checks every component inside it.- Specified by:
isMessageCompatible
in interfaceComponent
- Returns:
- True, if this Component (and its children) is compatible with messages.
-
isModalCompatible
default boolean isModalCompatible()Description copied from interface:Component
Whether this Component is compatible withModals
.
If the component in question contains other components, this also checks every component inside it.- Specified by:
isModalCompatible
in interfaceComponent
- Returns:
- True, if this Component (and its children) is compatible with modals.
-
replace
Description copied from interface:IReplaceable
Replaces and/or removes children components using the providedComponentReplacer
, and construct a new component from the result.- Specified by:
replace
in interfaceIReplaceable
- Parameters:
replacer
- TheComponentReplacer
to apply- Returns:
- The new, updated component
- 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 interfaceContainerChildComponent
- Specified by:
withUniqueId
in interfaceIDisableable
- Specified by:
withUniqueId
in interfaceMessageTopLevelComponent
- Parameters:
uniqueId
- The new ID; must be higher or equal to 1- Returns:
- The new component
-
withDisabled
Description copied from interface:IDisableable
Returns a new instance of this component in an enabled/disabled state.
For layout components, this enables/disables all the components it contains.- Specified by:
withDisabled
in interfaceIDisableable
- Returns:
- The new component in an enabled/disabled state
- See Also:
-
asDisabled
Description copied from interface:IDisableable
Returns a new instance of this component in a disabled state.
For layout components, this disables all the components it contains.- Specified by:
asDisabled
in interfaceIDisableable
- Returns:
- The new component in a disabled state
- See Also:
-
asEnabled
Description copied from interface:IDisableable
Returns a new instance of this component in an enabled state.
For layout components, this enables all the components it contains.- Specified by:
asEnabled
in interfaceIDisableable
- Returns:
- The new component in an enabled state
- See Also:
-
getContentComponents
Returns an immutable list with the components contained by this section.- Returns:
List
ofSectionContentComponentUnion
in this section
-
getAccessory
The accessory of this section.- Returns:
- Accessory of this section
-
isDisabled
default boolean isDisabled()Description copied from interface:IDisableable
Whether this component is disabled.For layout components, this means all children are enabled.
When this returnsfalse
, this does not meanIDisableable.isEnabled()
istrue
! (for example, when one component is enabled and the other is disabled)You can use
IDisableable.asDisabled()
orIDisableable.asEnabled()
to create enabled/disabled instances.- Specified by:
isDisabled
in interfaceIDisableable
- Returns:
true
, if this component is disabled
-
isEnabled
default boolean isEnabled()Description copied from interface:IDisableable
Whether this component is enabled.For layout components, this means all children are enabled.
When this returnsfalse
, this does not meanIDisableable.isDisabled()
istrue
! (for example, when one component is enabled and the other is disabled)You can use
IDisableable.asDisabled()
orIDisableable.asEnabled()
to create enabled/disabled instances.- Specified by:
isEnabled
in interfaceIDisableable
- Returns:
true
if this component is enabled
-