Class FileDisplayImpl
java.lang.Object
net.dv8tion.jda.internal.components.AbstractComponentImpl
net.dv8tion.jda.internal.components.filedisplay.FileDisplayImpl
- All Implemented Interfaces:
Component
,ContainerChildComponent
,ContainerChildComponentUnion
,FileDisplay
,IComponentUnion
,MessageTopLevelComponent
,MessageTopLevelComponentUnion
,SerializableData
,FileContainerMixin
public class FileDisplayImpl
extends AbstractComponentImpl
implements FileDisplay, MessageTopLevelComponentUnion, ContainerChildComponentUnion, FileContainerMixin
Represents either an attachment:// link, or a deserialized file component
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.components.Component
Component.Type
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
getFiles()
The media resolved from this file, 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 file, this is always where the file originally came from.int
hashCode()
boolean
Whether this file is hidden until the user clicks on it.toData()
SerializedDataObject
for this object.toString()
withSpoiler
(boolean spoiler) Creates a newFileDisplay
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.container.ContainerChildComponentUnion
asActionRow, asFileDisplay, asMediaGallery, asSection, asSeparator, asTextDisplay
Methods inherited from interface net.dv8tion.jda.api.components.IComponentUnion
isUnknownComponent
Methods inherited from interface net.dv8tion.jda.api.components.MessageTopLevelComponentUnion
asActionRow, asContainer, asFileDisplay, asMediaGallery, asSection, asSeparator, asTextDisplay
-
Constructor Details
-
FileDisplayImpl
-
FileDisplayImpl
-
-
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 interfaceContainerChildComponent
- Specified by:
withUniqueId
in interfaceContainerChildComponentUnion
- Specified by:
withUniqueId
in interfaceFileDisplay
- Specified by:
withUniqueId
in interfaceIComponentUnion
- Specified by:
withUniqueId
in interfaceMessageTopLevelComponent
- Specified by:
withUniqueId
in interfaceMessageTopLevelComponentUnion
- Parameters:
uniqueId
- The new ID; must be higher or equal to 1- Returns:
- The new component
-
withSpoiler
Description copied from interface:FileDisplay
Creates a newFileDisplay
with the provided spoiler status.
Spoilers are hidden until the user clicks on it.- Specified by:
withSpoiler
in interfaceFileDisplay
- Parameters:
spoiler
- The new spoiler status- Returns:
- The new
FileDisplay
-
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:FileDisplay
The URL of this file, 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
FileDisplay.getResolvedMedia()
thenResolvedMedia.getProxy()
, to avoid connecting your bot to unknown servers.- Specified by:
getUrl
in interfaceFileDisplay
- Returns:
- The URL of this file
-
getResolvedMedia
Description copied from interface:FileDisplay
The media resolved from this file, this is only available if you receive this component from Discord.- Specified by:
getResolvedMedia
in interfaceFileDisplay
- Returns:
- Possibly-null
ResolvedMedia
-
getFiles
- Specified by:
getFiles
in interfaceFileContainerMixin
-
isSpoiler
public boolean isSpoiler()Description copied from interface:FileDisplay
Whether this file is hidden until the user clicks on it.- Specified by:
isSpoiler
in interfaceFileDisplay
- Returns:
true
if this is hidden by default,false
otherwise
-
toData
Description copied from interface:SerializableData
SerializedDataObject
for this object.- Specified by:
toData
in interfaceSerializableData
- Returns:
DataObject
-
equals
-
hashCode
public int hashCode() -
toString
-