Interface TextDisplay
- All Superinterfaces:
Component
,ContainerChildComponent
,MessageTopLevelComponent
,SectionContentComponent
- All Known Implementing Classes:
TextDisplayImpl
public interface TextDisplay
extends Component, MessageTopLevelComponent, ContainerChildComponent, SectionContentComponent
A component to display text, supports Markdown.
This component has no content length limit, however, you are still limited to the 4000 total characters, as imposed by components V2.
Requirements: Components V2 needs to be enabled!
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.Component
Component.Type
-
Method Summary
Modifier and TypeMethodDescriptionThe content of thisTextDisplay
.static TextDisplay
Constructs a newTextDisplay
from the given content.static TextDisplay
Constructs a newTextDisplay
from the given format string and arguments.withContent
(String content) Creates a newTextDisplay
with the specified content.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
-
Method Details
-
of
Constructs a newTextDisplay
from the given content.- Parameters:
content
- The content of the text display- Returns:
- The new
TextDisplay
- Throws:
IllegalArgumentException
- If the content isnull
, blank or empty
-
ofFormat
Constructs a newTextDisplay
from the given format string and arguments.- Parameters:
format
- The content to format with the following argumentsargs
- The arguments to format the content with, if there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The behaviour on anull
argument depends on the conversion.- Returns:
- The new
TextDisplay
- Throws:
IllegalArgumentException
- If the format string isnull
, or the resulting content is blankIllegalFormatException
- If the format string contains an illegal syntax, a format specifier that is incompatible with the given arguments, insufficient arguments given the format string, or other illegal conditions. For specification of all possible formatting errors, see the Details section of the formatter class specification.
-
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 interfaceMessageTopLevelComponent
- Specified by:
withUniqueId
in interfaceSectionContentComponent
- Parameters:
uniqueId
- The new ID; must be higher or equal to 1- Returns:
- The new component
-
withContent
Creates a newTextDisplay
with the specified content.While there are no per-component limit, you are still limited to the 4000 total character limit.
- Parameters:
content
- The new content- Returns:
- The new
TextDisplay
-
getContent
The content of thisTextDisplay
.- Returns:
- The content
-