AttachmentBuilder
BuilderOn this page
AttachmentBuilder is a fluent payload builder. Chain setters, then pass the builder to send, reply, or command registration.
Constructor
AttachmentBuilder.new(data, name) The class table is callable, so AttachmentBuilder(data, name) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
data |
any |
required | Passed through to the implementation as written. |
name |
any |
required | Passed through to the implementation as written. |
local discord = require("discord")
local object = discord.AttachmentBuilder({}, {})Properties
- 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.
- 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.
- 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.
- 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.
- Name
name- Type
any- Access
- mutable
- Description
- Display name of this AttachmentBuilder.
- Availability
- Populated from the Gateway/REST payload or constructor for this AttachmentBuilder.
- 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.
- 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.
- 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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
data |
any |
required | Passed through to the implementation as written. |
name |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a AttachmentBuilder
AttachmentBuilder.from(data, name)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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
description |
any |
required | Passed through to the implementation as written. |
Returns
AttachmentBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
duration |
any |
required | Passed through to the implementation as written. |
Returns
AttachmentBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
data |
any |
required | Passed through to the implementation as written. |
Returns
AttachmentBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
name |
any |
required | Passed through to the implementation as written. |
Returns
AttachmentBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
spoiler |
any |
required | Passed through to the implementation as written. |
Returns
AttachmentBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
title |
any |
required | Passed through to the implementation as written. |
Returns
AttachmentBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
waveform |
any |
required | Passed through to the implementation as written. |
Returns
AttachmentBuilder — the same instance, for chaining.
Example
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
local discord = require("discord")
-- object is a AttachmentBuilder
object:toJSON()Examples
local discord = require("discord")
local object = discord.AttachmentBuilder({})Related APIs
ActionRowBuilder · ButtonBuilder · ChannelSelectMenuBuilder · CheckboxBuilder · ContainerBuilder · ContextMenuCommandBuilder · EmbedBuilder · FileBuilder
Version: discord 1.2.4 · runtime 1.0.0