Interface Separator

All Superinterfaces:
Component, ContainerChildComponent, MessageTopLevelComponent

public interface Separator extends Component, MessageTopLevelComponent, ContainerChildComponent
A component to separate content vertically, you can change its size and make it invisible.

Requirements: Components V2 needs to be enabled!

  • Method Details

    • createDivider

      @Nonnull static Separator createDivider(@Nonnull Separator.Spacing spacing)
      Constructs a new, visible Separator from the given content.
      This is equivalent to create(true, spacing).
      Parameters:
      spacing - The spacing provided by the separator
      Returns:
      The new Separator
      Throws:
      IllegalArgumentException - If null is provided
    • createInvisible

      @Nonnull static Separator createInvisible(@Nonnull Separator.Spacing spacing)
      Constructs a new, invisible Separator from the given content.
      This is equivalent to create(false, spacing).
      Parameters:
      spacing - The spacing provided by the separator
      Returns:
      The new Separator
      Throws:
      IllegalArgumentException - If null is provided
    • create

      @Nonnull static Separator create(boolean isDivider, @Nonnull Separator.Spacing spacing)
      Constructs a new Separator from the given content.
      Parameters:
      isDivider - Whether the separator is visible
      spacing - The spacing provided by the separator
      Returns:
      The new Separator
      Throws:
      IllegalArgumentException - If null is provided
    • withUniqueId

      @Nonnull @CheckReturnValue Separator 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
      Parameters:
      uniqueId - The new ID; must be higher or equal to 1
      Returns:
      The new component
    • withDivider

      @Nonnull @CheckReturnValue Separator withDivider(boolean divider)
      Creates a new Separator with the provided divider status.
      Parameters:
      divider - The new divider status, true to make it visible, false is invisible
      Returns:
      The new Separator
    • withSpacing

      @Nonnull @CheckReturnValue Separator withSpacing(@Nonnull Separator.Spacing spacing)
      Creates a new Separator with the provided spacing.
      Parameters:
      spacing - The new spacing
      Returns:
      The new Separator
    • isDivider

      boolean isDivider()
      Whether this separator is visible or not.
      Returns:
      true if this separate is a divider, and thus visible, false otherwise
    • getSpacing

      @Nonnull Separator.Spacing getSpacing()
      The spacing of this separator.
      Returns:
      The spacing