Class SequencedTextDisplay

java.lang.Object
net.dv8tion.jda.internal.components.AbstractComponentImpl
net.dv8tion.jda.internal.components.textdisplay.TextDisplayImpl
io.github.kaktushose.jdac.components.SequencedTextDisplay
All Implemented Interfaces:
LocalizedComponent, SequencedComponent<TextDisplay>, Component, ContainerChildComponent, ContainerChildComponentUnion, IComponentUnion, MessageTopLevelComponent, MessageTopLevelComponentUnion, ModalTopLevelComponent, ModalTopLevelComponentUnion, SectionContentComponent, SectionContentComponentUnion, TextDisplay, SerializableData

public final class SequencedTextDisplay extends net.dv8tion.jda.internal.components.textdisplay.TextDisplayImpl implements SequencedComponent<TextDisplay>

A TextDisplay implementation that is backed by a SequencedCollection and allows its content to be appended in sequence.

The add(String, Entry...) methods of this class will first append to an internally stored SequencedCollection. When getContent() or toData() gets called, this collection gets unfolded and all TextDisplays are joined into one. textDisplays() will return the TextDisplays directly as stored in the SequencedCollection.

Usage inside SequencedContainers

If used inside a SequencedContainer, the TextDisplays don't get joined and each TextDisplay will be added individually in sequence.

Localization

This TextDisplay implementation also supports localization. When [#getContent()()] or toData() is called, the content of this TextDisplay is localized via ComponentResolver. Use entries(Entry...) to provide additional Entries outside the add(String, Entry...) methods.

Usage outside JDA-Commands

TextDisplay.of(String) uses the JDACIntrospection API to access a Resolver and the user locale. This means, the static of factory method is only usable in JDACScope.PREPARATION. If you want to use this class outside JDA-Commands call the constructor and pass the Resolver as well as the Locale manually.

var textDisplay = new SequencedTextDisplay(resolver, locale, TextDisplay.of("Hello World!));