ContainerBuilder
BuilderOn this page
ContainerBuilder is a fluent payload builder. Chain setters, then pass the builder to send, reply, or command registration.
Constructor
ContainerBuilder.new() The class table is callable, so ContainerBuilder() is the same as .new.
No parameters.
local discord = require("discord")
local object = discord.ContainerBuilder()Properties
- Name
data- Type
any- Access
- readonly
- Description
- Instance field
ContainerBuilder.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 ContainerBuilder.
Methods
ContainerBuilder:addComponents()
#Add Components to this ContainerBuilder.
Signature
ContainerBuilder:addComponents(...) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
... |
any |
required | Passed through to the implementation as written. |
Returns
ContainerBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ContainerBuilder
object:addComponents(...)ContainerBuilder:setAccentColor()
#Set the AccentColor field. Builders return this ContainerBuilder so setters can be chained.
Signature
ContainerBuilder:setAccentColor(color) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
color |
any |
required | Passed through to the implementation as written. |
Returns
ContainerBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ContainerBuilder
object:setAccentColor(color)ContainerBuilder:setSpoiler()
#Set the Spoiler field. Builders return this ContainerBuilder so setters can be chained.
Signature
ContainerBuilder:setSpoiler(spoiler) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
spoiler |
any |
required | Passed through to the implementation as written. |
Returns
ContainerBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ContainerBuilder
object:setSpoiler(spoiler)ContainerBuilder:toJSON()
#Serialize this ContainerBuilder into a Lua table suitable for REST or debugging.
Signature
ContainerBuilder:toJSON() Parameters
No parameters.
Returns
ContainerBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ContainerBuilder
object:toJSON()Examples
local discord = require("discord")
local object = discord.ContainerBuilder({})Related APIs
ActionRowBuilder · AttachmentBuilder · ButtonBuilder · ChannelSelectMenuBuilder · CheckboxBuilder · ContextMenuCommandBuilder · EmbedBuilder · FileBuilder
Version: discord 1.2.4 · runtime 1.0.0