Class AttachmentUpload.Builder
java.lang.Object
net.dv8tion.jda.api.components.attachmentupload.AttachmentUpload.Builder
- Enclosing interface:
AttachmentUpload
Builder for
AttachmentUploads
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newAttachmentUpload
.Returns the unique custom ID, this can be used to pass data, then read in an interaction.int
The maximum amount of attachments the user can send.int
The minimum amount of attachments the user must send.int
The unique, numeric identifier of this component.boolean
Whether the user must send attachments.setCustomId
(String customId) Changes the custom ID.setMaxValues
(int maxValues) Changes the maximum amount of attachments the user can send.setMinValues
(int minValues) Changes the minimum amount of attachments the user has to send.setRequired
(boolean required) Changes whether the user must upload files.setRequiredRange
(int min, int max) Changes the amounts of attachments the user can send.setUniqueId
(int uniqueId)
-
Method Details
-
setUniqueId
-
setCustomId
Changes the custom ID.
This ID can be used to pass data, then read in an interaction.- Parameters:
customId
- The new custom ID- Returns:
- The same instance, for chaining purposes
- Throws:
IllegalArgumentException
- IfcustomId
isnull
, blank, or longer than 100 characters
-
setMinValues
Changes the minimum amount of attachments the user has to send.
Default:1
- Parameters:
minValues
- The new minimum amount of attachments the user has to send, must be >= 0 and less than 10- Returns:
- The same instance, for chaining purposes
- Throws:
IllegalArgumentException
- IfminValues
is negative or larger than 10
-
setMaxValues
Changes the maximum amount of attachments the user can send.
Default:1
- Parameters:
maxValues
- The new maximum amount of attachments the user can send, must be positive and less than 10- Returns:
- The same instance, for chaining purposes
- Throws:
IllegalArgumentException
- IfmaxValues
is negative, zero, or larger than 10
-
setRequiredRange
Changes the amounts of attachments the user can send.
Default:[1 ; 1]
- Parameters:
min
- The new minimum amount of attachments the user must send, must be >= 0 and less than 10max
- The new maximum amount of attachments the user can send, must be positive and less than 10- Returns:
- The same instance, for chaining purposes
- Throws:
IllegalArgumentException
-
-
setRequired
Changes whether the user must upload files.
Default:true
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.- Parameters:
required
- The new required status- Returns:
- The same instance, for chaining purposes
-
getUniqueId
public int getUniqueId()The unique, numeric identifier of this component.
Can be set manually or automatically assigned by Discord (starting from1
). If it has not been assigned yet, this will return-1
.- Returns:
- The unique identifier of this component, or
-1
if not assigned yet
-
getCustomId
Returns the unique custom ID, this can be used to pass data, then read in an interaction.- Returns:
- The custom ID
-
getMinValues
public int getMinValues()The minimum amount of attachments the user must send.- Returns:
- Minimum amount of attachments the user must send
-
getMaxValues
public int getMaxValues()The maximum amount of attachments the user can send.- Returns:
- Maximum amount of attachments the user can send
-
isRequired
public 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
-
build
Builds a newAttachmentUpload
.- Returns:
- The new
AttachmentUpload
- Throws:
IllegalArgumentException
- If min values is larger than max values
-