Attachment
ClassOn this page
Attachment is a DiscordLua class representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.
Properties
- Name
client- Type
any- Access
- readonly
- Description
- Owning Client instance used for REST, cache, and event dispatch.
- Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
contentType- Type
any- Access
- readonly
- Description
- Instance field
Attachment.contentType. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
description- Type
any- Access
- readonly
- Description
- Instance field
Attachment.description. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
duration- Type
any- Access
- readonly
- Description
- Instance field
Attachment.duration. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
ephemeral- Type
any- Access
- readonly
- Description
- Instance field
Attachment.ephemeral. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
filename- Type
any- Access
- readonly
- Description
- Instance field
Attachment.filename. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
flags- Type
any- Access
- readonly
- Description
- Instance field
Attachment.flags. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
height- Type
any- Access
- readonly
- Description
- Instance field
Attachment.height. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
id- Type
any- Access
- readonly
- Description
- Snowflake id of this Attachment.
- Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
name- Type
any- Access
- readonly
- Description
- Display name of this Attachment.
- Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
proxyURL- Type
any- Access
- readonly
- Description
- Instance field
Attachment.proxyURL. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
raw- Type
any- Access
- readonly
- Description
- Instance field
Attachment.raw. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
size- Type
any- Access
- readonly
- Description
- Instance field
Attachment.size. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
spoiler- Type
any- Access
- readonly
- Description
- Instance field
Attachment.spoiler. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
title- Type
any- Access
- readonly
- Description
- Instance field
Attachment.title. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
url- Type
any- Access
- readonly
- Description
- Instance field
Attachment.url. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
waveform- Type
any- Access
- readonly
- Description
- Instance field
Attachment.waveform. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
- Name
width- Type
any- Access
- readonly
- Description
- Instance field
Attachment.width. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this Attachment.
Methods
Attachment:isImage()
#Predicate that returns whether this Attachment matches isImage. Use it to branch before calling type-specific methods.
Signature
Attachment:isImage() Parameters
No parameters.
Returns
any.
Example
local discord = require("discord")
-- object is a Attachment
object:isImage()Attachment:isSpoiler()
#Predicate that returns whether this Attachment matches isSpoiler. Use it to branch before calling type-specific methods.
Signature
Attachment:isSpoiler() Parameters
No parameters.
Returns
Attachment — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a Attachment
object:isSpoiler()Attachment:isVideo()
#Predicate that returns whether this Attachment matches isVideo. Use it to branch before calling type-specific methods.
Signature
Attachment:isVideo() Parameters
No parameters.
Returns
any.
Example
local discord = require("discord")
-- object is a Attachment
object:isVideo()Attachment:toJSON()
#Serialize this Attachment into a Lua table suitable for REST or debugging.
Signature
Attachment:toJSON() Parameters
No parameters.
Returns
any.
Example
local discord = require("discord")
-- object is a Attachment
object:toJSON()Examples
Obtain this object from a manager, wrap helper, or event payload — it is not constructed directly in typical bot code.
Related APIs
ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · AuthorizingIntegrationOwners
Version: discord 1.2.4 · runtime 1.0.0