Interface AttachmentUpload

All Superinterfaces:
Component, ICustomId, LabelChildComponent

public interface AttachmentUpload extends Component, ICustomId, LabelChildComponent
Component accepting files from users.

The user can send up to 10 files, the requested number of files can be adjusted or be completely optional.

Can only be used inside Labels!

  • Field Details

    • MAX_UPLOADS

      static final int MAX_UPLOADS
      The maximum number of files the user can upload at once (10)
      See Also:
    • ID_MAX_LENGTH

      static final int ID_MAX_LENGTH
      The maximum length a custom ID can have (100)
      See Also:
  • Method Details

    • create

      Creates a new AttachmentUpload.Builder with the provided custom ID.
      By default, the user will be required to submit a single attachment.
      Parameters:
      customId - The custom ID of this component, can be used to pass data, then read in an interaction
      Returns:
      The new AttachmentUpload.Builder
      Throws:
      IllegalArgumentException - If customId is null, blank, or longer than 100 characters
    • of

      @Nonnull static AttachmentUpload of(@Nonnull String customId)
      Creates a new AttachmentUpload with the provided custom ID.
      The user will be required to submit a single attachment.
      Parameters:
      customId - The custom ID of this component, can be used to pass data, then read in an interaction
      Returns:
      The new AttachmentUpload
      Throws:
      IllegalArgumentException - If customId is null, blank, or longer than 100 characters
    • withUniqueId

      @Nonnull @CheckReturnValue AttachmentUpload 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 ICustomId
      Specified by:
      withUniqueId in interface LabelChildComponent
      Parameters:
      uniqueId - The new ID; must be higher or equal to 1
      Returns:
      The new component
    • getMinValues

      int getMinValues()
      The minimum amount of attachments the user must send.
      Returns:
      Minimum amount of attachments the user must send
    • getMaxValues

      int getMaxValues()
      The maximum amount of attachments the user can send.
      Returns:
      Maximum amount of attachments the user can send
    • isRequired

      boolean isRequired()
      Whether the user must send attachments.

      This attribute is completely separate from the value range, for example you can have an optional AttachmentUpload with the range set to [2 ; 2], meaning you accept either 0 attachments, or 2.

      Returns:
      true if files must be uploaded, false if not