DiscordLua
discorddiscord
v1.2.4
Install

Attachment

Class
On 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.

class Module 1.2.4 Source

Properties

Attachment.client

# readonly
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.

Attachment.contentType

# readonly
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.

Attachment.description

# readonly
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.

Attachment.duration

# readonly
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.

Attachment.ephemeral

# readonly
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.

Attachment.filename

# readonly
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.

Attachment.flags

# readonly
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.

Attachment.height

# readonly
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.

Attachment.id

# readonly
Name
id
Type
any
Access
readonly
Description
Snowflake id of this Attachment.
Availability
Populated from the Gateway/REST payload or constructor for this Attachment.

Attachment.name

# readonly
Name
name
Type
any
Access
readonly
Description
Display name of this Attachment.
Availability
Populated from the Gateway/REST payload or constructor for this Attachment.

Attachment.proxyURL

# readonly
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.

Attachment.raw

# readonly
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.

Attachment.size

# readonly
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.

Attachment.spoiler

# readonly
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.

Attachment.title

# readonly
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.

Attachment.url

# readonly
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.

Attachment.waveform

# readonly
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.

Attachment.width

# readonly
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

lua
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

lua
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

lua
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

lua
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.

ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · AuthorizingIntegrationOwners

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc