Interface TextDisplay

All Superinterfaces:
Component, ContainerChildComponent, MessageTopLevelComponent, ModalTopLevelComponent, 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!

  • Method Details

    • of

      @Nonnull static TextDisplay of(@Nonnull String content)
      Constructs a new TextDisplay from the given content.
      Parameters:
      content - The content of the text display
      Returns:
      The new TextDisplay
      Throws:
      IllegalArgumentException - If the content is null, blank or empty
    • ofFormat

      @Nonnull static TextDisplay ofFormat(@Nonnull String format, @Nonnull Object... args)
      Constructs a new TextDisplay from the given format string and arguments.
      Parameters:
      format - The content to format with the following arguments
      args - 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 a null argument depends on the conversion.
      Returns:
      The new TextDisplay
      Throws:
      IllegalArgumentException - If the format string is null, or the resulting content is blank
      IllegalFormatException - 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

      @Nonnull @CheckReturnValue TextDisplay withUniqueId(int uniqueId)
      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 interface Component
      Specified by:
      withUniqueId in interface ContainerChildComponent
      Specified by:
      withUniqueId in interface MessageTopLevelComponent
      Specified by:
      withUniqueId in interface ModalTopLevelComponent
      Specified by:
      withUniqueId in interface SectionContentComponent
      Parameters:
      uniqueId - The new ID; must be higher or equal to 1
      Returns:
      The new component
    • withContent

      @Nonnull @CheckReturnValue TextDisplay withContent(@Nonnull String content)
      Creates a new TextDisplay 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

      @Nonnull String getContent()
      The content of this TextDisplay.
      Returns:
      The content