Class AttachmentUpload.Builder
java.lang.Object
net.dv8tion.jda.api.components.attachmentupload.AttachmentUpload.Builder
- All Implemented Interfaces:
IFilterableFileTypes<AttachmentUpload.Builder>
- Enclosing interface:
AttachmentUpload
public static class AttachmentUpload.Builder
extends Object
implements IFilterableFileTypes<AttachmentUpload.Builder>
Builder for
AttachmentUploads.-
Field Summary
Fields inherited from interface IFilterableFileTypes
MAX_FILE_TYPES -
Method Summary
Modifier and TypeMethodDescriptionaddFileTypes(Collection<FileType> fileTypes) build()Builds a newAttachmentUpload.Returns the unique custom ID, this can be used to pass data, then read in an interaction.The unmodifiable list view of file types to filter for.intThe maximum amount of attachments the user can send.intThe minimum amount of attachments the user must send.intThe unique, numeric identifier of this component.booleanWhether the user must send attachments.setCustomId(String customId) Changes the custom ID.setFileTypes(Collection<FileType> fileTypes) 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) Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IFilterableFileTypes
addFileTypeExtensions, addFileTypeExtensions, addFileTypes, setFileTypeExtensions, setFileTypeExtensions, setFileTypes
-
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- IfcustomIdisnull, 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- IfminValuesis 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- IfmaxValuesis 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-
-
addFileTypes
Description copied from interface:IFilterableFileTypes- Specified by:
addFileTypesin interfaceIFilterableFileTypes<AttachmentUpload.Builder>- Parameters:
fileTypes- The file types, up to 10<T extends IFilterableFileTypes<T>>- Returns:
- This instance for chaining
-
setFileTypes
Description copied from interface:IFilterableFileTypesSets up to 10<T extends IFilterableFileTypes<T>> file types to filter for. Pass an empty collection to remove file type filtering.- Specified by:
setFileTypesin interfaceIFilterableFileTypes<AttachmentUpload.Builder>- Parameters:
fileTypes- The file types, up to 10<T extends IFilterableFileTypes<T>>- Returns:
- This instance for chaining
-
setRequired
Changes whether the user must upload files.
Default:trueThis attribute is completely separate from the value range, for example you can have an optional
AttachmentUploadwith 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
-1if 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
-
getFileTypes
-
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
AttachmentUploadwith the range set to[2 ; 2], meaning you accept either 0 attachments, or 2.- Returns:
trueif files must be uploaded,falseif not
-
build
Builds a newAttachmentUpload.- Returns:
- The new
AttachmentUpload - Throws:
IllegalArgumentException- If min values is larger than max values
-