DiscordLua
discorddiscord
v1.2.4
Install

AttachmentBuilder

Builder
On this page

AttachmentBuilder is a fluent payload builder. Chain setters, then pass the builder to send, reply, or command registration.

builder Module 1.2.4 Source

Constructor

AttachmentBuilder.new(data, name)

The class table is callable, so AttachmentBuilder(data, name) is the same as .new.

NameTypeRequiredBehavior
data any required Passed through to the implementation as written.
name any required Passed through to the implementation as written.
lua
local discord = require("discord")
local object = discord.AttachmentBuilder({}, {})

Properties

AttachmentBuilder.attachment

# readonly
Name
attachment
Type
any
Access
readonly
Description
Instance field AttachmentBuilder.attachment. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this AttachmentBuilder.

AttachmentBuilder.data

# readonly
Name
data
Type
any
Access
readonly
Description
Instance field AttachmentBuilder.data. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this AttachmentBuilder.

AttachmentBuilder.description

# mutable
Name
description
Type
any
Access
mutable
Description
Instance field AttachmentBuilder.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 AttachmentBuilder.

AttachmentBuilder.duration

# mutable
Name
duration
Type
any
Access
mutable
Description
Instance field AttachmentBuilder.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 AttachmentBuilder.

AttachmentBuilder.name

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

AttachmentBuilder.spoiler

# mutable
Name
spoiler
Type
any
Access
mutable
Description
Instance field AttachmentBuilder.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 AttachmentBuilder.

AttachmentBuilder.title

# mutable
Name
title
Type
any
Access
mutable
Description
Instance field AttachmentBuilder.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 AttachmentBuilder.

AttachmentBuilder.waveform

# mutable
Name
waveform
Type
any
Access
mutable
Description
Instance field AttachmentBuilder.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 AttachmentBuilder.

Methods

AttachmentBuilder.from()

# static

Performs from on this AttachmentBuilder. Call it from bot code when you need that operation on the current object.

Signature

AttachmentBuilder.from(data, name)

Parameters

NameTypeRequiredBehavior
data any required Passed through to the implementation as written.
name any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a AttachmentBuilder
AttachmentBuilder.from(data, name)

AttachmentBuilder.fromPath()

# static

Performs from path on this AttachmentBuilder. Call it from bot code when you need that operation on the current object.

Signature

AttachmentBuilder.fromPath(path, name)

Parameters

NameTypeRequiredBehavior
path any required Passed through to the implementation as written.
name any required Passed through to the implementation as written.

Returns

any.

Throws

A DiscordLua error when arguments are invalid or the request fails without a callback.

Example

lua
local discord = require("discord")
-- object is a AttachmentBuilder
AttachmentBuilder.fromPath(path, name)

AttachmentBuilder:setDescription()

#

Set the Description field. Builders return this AttachmentBuilder so setters can be chained.

Signature

AttachmentBuilder:setDescription(description)

Parameters

NameTypeRequiredBehavior
description any required Passed through to the implementation as written.

Returns

AttachmentBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a AttachmentBuilder
object:setDescription(description)

AttachmentBuilder:setDuration()

#

Set the Duration field. Builders return this AttachmentBuilder so setters can be chained.

Signature

AttachmentBuilder:setDuration(duration)

Parameters

NameTypeRequiredBehavior
duration any required Passed through to the implementation as written.

Returns

AttachmentBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a AttachmentBuilder
object:setDuration(duration)

AttachmentBuilder:setFile()

#

Set the File field. Builders return this AttachmentBuilder so setters can be chained.

Signature

AttachmentBuilder:setFile(data)

Parameters

NameTypeRequiredBehavior
data any required Passed through to the implementation as written.

Returns

AttachmentBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a AttachmentBuilder
object:setFile(data)

AttachmentBuilder:setName()

#

Set the Name field. Builders return this AttachmentBuilder so setters can be chained.

Signature

AttachmentBuilder:setName(name)

Parameters

NameTypeRequiredBehavior
name any required Passed through to the implementation as written.

Returns

AttachmentBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a AttachmentBuilder
object:setName(name)

AttachmentBuilder:setSpoiler()

#

Set the Spoiler field. Builders return this AttachmentBuilder so setters can be chained.

Signature

AttachmentBuilder:setSpoiler(spoiler)

Parameters

NameTypeRequiredBehavior
spoiler any required Passed through to the implementation as written.

Returns

AttachmentBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a AttachmentBuilder
object:setSpoiler(spoiler)

AttachmentBuilder:setTitle()

#

Set the Title field. Builders return this AttachmentBuilder so setters can be chained.

Signature

AttachmentBuilder:setTitle(title)

Parameters

NameTypeRequiredBehavior
title any required Passed through to the implementation as written.

Returns

AttachmentBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a AttachmentBuilder
object:setTitle(title)

AttachmentBuilder:setWaveform()

#

Set the Waveform field. Builders return this AttachmentBuilder so setters can be chained.

Signature

AttachmentBuilder:setWaveform(waveform)

Parameters

NameTypeRequiredBehavior
waveform any required Passed through to the implementation as written.

Returns

AttachmentBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a AttachmentBuilder
object:setWaveform(waveform)

AttachmentBuilder:toJSON()

#

Serialize this AttachmentBuilder into a Lua table suitable for REST or debugging.

Signature

AttachmentBuilder:toJSON()

Parameters

No parameters.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a AttachmentBuilder
object:toJSON()

Examples

lua
local discord = require("discord")
local object = discord.AttachmentBuilder({})

ActionRowBuilder · ButtonBuilder · ChannelSelectMenuBuilder · CheckboxBuilder · ContainerBuilder · ContextMenuCommandBuilder · EmbedBuilder · FileBuilder

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc