Class FileType
java.lang.Object
net.dv8tion.jda.api.interactions.FileType
Represents a type of file, you can use presets such as
IMAGE,
or specify an extension using ofExtension(String).
Remember that this only checks the extension, Discord does not check for any file signature/MIME type, and thus does not guarantee receiving a valid file.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetValue()The raw value of this file type.inthashCode()booleanisAudio()Whether this file type accepts all audio formats supported by Discord.booleanisImage()Whether this file type accepts all image formats supported by Discord.booleanisVideo()Whether this file type accepts all video formats supported by Discord.static FileTypeofExtension(String extension) Creates aFileTypematching the provided extension.toString()
-
Field Details
-
IMAGE
Matches any image supported by the Discord client. -
VIDEO
Matches any video supported by the Discord client. -
AUDIO
Matches any audio supported by the Discord client.
-
-
Constructor Details
-
FileType
-
-
Method Details
-
ofExtension
Creates aFileTypematching the provided extension.- Parameters:
extension- The extension to match against.- Returns:
- The new
FileType - Throws:
IllegalArgumentException-- If the extension is
nullor empty - If the extension does not match
[\w\-.]+(latin letters, digits, dashes or dots)
- If the extension is
-
isImage
public boolean isImage()Whether this file type accepts all image formats supported by Discord.- Returns:
trueif this file type accepts all image formats supported by Discord,falseif not
-
isVideo
public boolean isVideo()Whether this file type accepts all video formats supported by Discord.- Returns:
trueif this file type accepts all video formats supported by Discord,falseif not
-
isAudio
public boolean isAudio()Whether this file type accepts all audio formats supported by Discord.- Returns:
trueif this file type accepts all audio formats supported by Discord,falseif not
-
getValue
-
equals
-
hashCode
-
toString
-