public final class Attachment extends Object implements Entity
Modifier and Type | Field and Description |
---|---|
static String |
SPOILER_PREFIX
The prefix of the name of files which are displayed as spoilers.
|
Constructor and Description |
---|
Attachment(GatewayDiscordClient gateway,
discord4j.discordjson.json.AttachmentData data)
Constructs an
Attachment with an associated ServiceMediator and Discord data. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
GatewayDiscordClient |
getClient()
Returns the
GatewayDiscordClient that created this object. |
String |
getFilename()
Gets the name of the file attached.
|
OptionalInt |
getHeight()
Gets the height of the file, if present.
|
Snowflake |
getId()
Gets the Snowflake that uniquely identifies this entity.
|
String |
getProxyUrl()
Gets a proxied URL of the file.
|
int |
getSize()
Gets the size of the file in bytes.
|
String |
getUrl()
Gets the source URL of the file.
|
OptionalInt |
getWidth()
Gets the width of the file, if present.
|
int |
hashCode() |
boolean |
isSpoiler()
Gets whether the attachment is a spoiler.
|
String |
toString() |
public static final String SPOILER_PREFIX
public Attachment(GatewayDiscordClient gateway, discord4j.discordjson.json.AttachmentData data)
Attachment
with an associated ServiceMediator and Discord data.gateway
- The GatewayDiscordClient
associated to this object, must be non-null.data
- The raw data as represented by Discord, must be non-null.public GatewayDiscordClient getClient()
DiscordObject
GatewayDiscordClient
that created this object. Methods in it are exclusively based on the
entity cache or Store
in use. Refer to calling getClient().rest()
to access a
DiscordClient
that is capable of requesting entities directly from the REST API.getClient
in interface DiscordObject
GatewayDiscordClient
associated to this object.public Snowflake getId()
Entity
public String getFilename()
public int getSize()
public String getUrl()
public String getProxyUrl()
public OptionalInt getHeight()
public OptionalInt getWidth()
public boolean isSpoiler()
true
if the attachment is a spoiler, false
otherwise.