Class ThumbnailImpl
java.lang.Object
net.dv8tion.jda.internal.components.AbstractComponentImpl
net.dv8tion.jda.internal.components.thumbnail.ThumbnailImpl
- All Implemented Interfaces:
Component
,IComponentUnion
,SectionAccessoryComponent
,SectionAccessoryComponentUnion
,Thumbnail
,SerializableData
,FileContainerMixin
public class ThumbnailImpl
extends AbstractComponentImpl
implements Thumbnail, SectionAccessoryComponentUnion, FileContainerMixin
Represents either an external link, an attachment:// link, or an existing item (which is also a link)
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.Component
Component.Type
-
Field Summary
Fields inherited from interface net.dv8tion.jda.api.components.thumbnail.Thumbnail
MAX_DESCRIPTION_LENGTH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
The description of this thumbnail, ornull
if none has been set.getFiles()
The media resolved from this thumbnail, this is only available if you receive this component from Discord.getType()
The type of component.int
The unique, numeric identifier of this component.getUrl()
The URL of this thumbnail, this is always where the file originally came from.int
hashCode()
boolean
Whether this thumbnail is hidden until the user clicks on it.toData()
SerializedDataObject
for this object.toString()
withDescription
(String description) Creates a newThumbnail
with the provided description.withSpoiler
(boolean spoiler) Creates a newThumbnail
with the provided spoiler status.withUniqueId
(int uniqueId) Creates a new component with the provided numeric ID.Methods inherited from class net.dv8tion.jda.internal.components.AbstractComponentImpl
asActionRow, asButton, asContainer, asEntitySelectMenu, asFileDisplay, asMediaGallery, asSection, asSeparator, asStringSelectMenu, asTextDisplay, asTextInput, asThumbnail
Methods inherited from interface net.dv8tion.jda.api.components.Component
isMessageCompatible, isModalCompatible
Methods inherited from interface net.dv8tion.jda.api.components.IComponentUnion
isUnknownComponent
Methods inherited from interface net.dv8tion.jda.api.components.section.SectionAccessoryComponentUnion
asButton, asThumbnail
-
Constructor Details
-
ThumbnailImpl
-
ThumbnailImpl
-
-
Method Details
-
getType
Description copied from interface:Component
The type of component.- Specified by:
getType
in interfaceComponent
- Returns:
Component.Type
-
withUniqueId
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 interfaceComponent
- Specified by:
withUniqueId
in interfaceIComponentUnion
- Specified by:
withUniqueId
in interfaceSectionAccessoryComponent
- Specified by:
withUniqueId
in interfaceSectionAccessoryComponentUnion
- Specified by:
withUniqueId
in interfaceThumbnail
- Parameters:
uniqueId
- The new ID; must be higher or equal to 1- Returns:
- The new component
-
withDescription
Description copied from interface:Thumbnail
Creates a newThumbnail
with the provided description.
The description is known as an "alternative text", and must not exceed 1024 characters.- Specified by:
withDescription
in interfaceThumbnail
- Parameters:
description
- The new description- Returns:
- The new
Thumbnail
-
withSpoiler
Description copied from interface:Thumbnail
Creates a newThumbnail
with the provided spoiler status.
Spoilers are hidden until the user clicks on it.- Specified by:
withSpoiler
in interfaceThumbnail
- Parameters:
spoiler
- The new spoiler status- Returns:
- The new
Thumbnail
-
getUniqueId
public int getUniqueId()Description copied from interface:Component
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
.Note: Older messages may return
0
.- Specified by:
getUniqueId
in interfaceComponent
- Returns:
- The unique identifier of this component, or
-1
if not assigned yet, or0
on older messages
-
getUrl
Description copied from interface:Thumbnail
The URL of this thumbnail, this is always where the file originally came from.
This can be eitherattachment://filename.extension
or an actual URL.If you want to download the file, you should use
Thumbnail.getResolvedMedia()
thenResolvedMedia.getProxy()
, to avoid connecting your bot to unknown servers. -
getResolvedMedia
Description copied from interface:Thumbnail
The media resolved from this thumbnail, this is only available if you receive this component from Discord.- Specified by:
getResolvedMedia
in interfaceThumbnail
- Returns:
- Possibly-null
ResolvedMedia
-
getFiles
- Specified by:
getFiles
in interfaceFileContainerMixin
-
getDescription
Description copied from interface:Thumbnail
The description of this thumbnail, ornull
if none has been set.- Specified by:
getDescription
in interfaceThumbnail
- Returns:
- Possibly-null description
-
isSpoiler
public boolean isSpoiler()Description copied from interface:Thumbnail
Whether this thumbnail is hidden until the user clicks on it. -
toData
Description copied from interface:SerializableData
SerializedDataObject
for this object.- Specified by:
toData
in interfaceSerializableData
- Returns:
DataObject
-
equals
-
hashCode
public int hashCode() -
toString
-