DiscordLua
discorddiscord
v1.2.4
Install

SlashCommandBuilder

Builder
On this page

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

builder Module 1.2.4 Source

Constructor

SlashCommandBuilder.new()

The class table is callable, so SlashCommandBuilder() is the same as .new.

No parameters.

lua
local discord = require("discord")
local object = discord.SlashCommandBuilder()

Properties

SlashCommandBuilder.data

# readonly
Name
data
Type
any
Access
readonly
Description
Instance field SlashCommandBuilder.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 SlashCommandBuilder.

Methods

SlashCommandBuilder:addAttachmentOption()

#

Add AttachmentOption to this SlashCommandBuilder.

Signature

SlashCommandBuilder:addAttachmentOption(input)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addAttachmentOption(input)

SlashCommandBuilder:addBooleanOption()

#

Add BooleanOption to this SlashCommandBuilder.

Signature

SlashCommandBuilder:addBooleanOption(input)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addBooleanOption(input)

SlashCommandBuilder:addChannelOption()

#

Add ChannelOption to this SlashCommandBuilder.

Signature

SlashCommandBuilder:addChannelOption(input)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addChannelOption(input)

SlashCommandBuilder:addIntegerOption()

#

Add IntegerOption to this SlashCommandBuilder.

Signature

SlashCommandBuilder:addIntegerOption(input)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addIntegerOption(input)

SlashCommandBuilder:addMentionableOption()

#

Add MentionableOption to this SlashCommandBuilder.

Signature

SlashCommandBuilder:addMentionableOption(input)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addMentionableOption(input)

SlashCommandBuilder:addNumberOption()

#

Add NumberOption to this SlashCommandBuilder.

Signature

SlashCommandBuilder:addNumberOption(input)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addNumberOption(input)

SlashCommandBuilder:addRoleOption()

#

Add RoleOption to this SlashCommandBuilder.

Signature

SlashCommandBuilder:addRoleOption(input)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addRoleOption(input)

SlashCommandBuilder:addStringOption()

#

Add StringOption to this SlashCommandBuilder.

Signature

SlashCommandBuilder:addStringOption(input)

Parameters

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

Returns

any.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addStringOption(input)

SlashCommandBuilder:addSubcommand()

#

Add Subcommand to this SlashCommandBuilder.

Signature

SlashCommandBuilder:addSubcommand(input)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addSubcommand(input)

SlashCommandBuilder:addSubcommandGroup()

#

Add SubcommandGroup to this SlashCommandBuilder.

Signature

SlashCommandBuilder:addSubcommandGroup(input)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addSubcommandGroup(input)

SlashCommandBuilder:addUserOption()

#

Add UserOption to this SlashCommandBuilder.

Signature

SlashCommandBuilder:addUserOption(input)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addUserOption(input)

SlashCommandBuilder:setContexts()

#

Set the Contexts field. Builders return this SlashCommandBuilder so setters can be chained.

Signature

SlashCommandBuilder:setContexts(first, ...)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:setContexts(first, ...)

SlashCommandBuilder:setDefaultMemberPermissions()

#

Set the DefaultMemberPermissions field. Builders return this SlashCommandBuilder so setters can be chained.

Signature

SlashCommandBuilder:setDefaultMemberPermissions(permissions)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:setDefaultMemberPermissions(permissions)

SlashCommandBuilder:setDescription()

#

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

Signature

SlashCommandBuilder:setDescription(description)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

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

SlashCommandBuilder:setDescriptionLocalizations()

#

Set the DescriptionLocalizations field. Builders return this SlashCommandBuilder so setters can be chained.

Signature

SlashCommandBuilder:setDescriptionLocalizations(localizations)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:setDescriptionLocalizations(localizations)

SlashCommandBuilder:setDMPermission()

#

Set the DMPermission field. Builders return this SlashCommandBuilder so setters can be chained.

Signature

SlashCommandBuilder:setDMPermission(enabled)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:setDMPermission(enabled)

SlashCommandBuilder:setIntegrationTypes()

#

Set the IntegrationTypes field. Builders return this SlashCommandBuilder so setters can be chained.

Signature

SlashCommandBuilder:setIntegrationTypes(first, ...)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:setIntegrationTypes(first, ...)

SlashCommandBuilder:setName()

#

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

Signature

SlashCommandBuilder:setName(name)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

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

SlashCommandBuilder:setNameLocalizations()

#

Set the NameLocalizations field. Builders return this SlashCommandBuilder so setters can be chained.

Signature

SlashCommandBuilder:setNameLocalizations(localizations)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:setNameLocalizations(localizations)

SlashCommandBuilder:setNSFW()

#

Set the NSFW field. Builders return this SlashCommandBuilder so setters can be chained.

Signature

SlashCommandBuilder:setNSFW(nsfw)

Parameters

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

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a SlashCommandBuilder
object:setNSFW(nsfw)

SlashCommandBuilder:toJSON()

#

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

Signature

SlashCommandBuilder:toJSON()

Parameters

No parameters.

Returns

SlashCommandBuilder — the same instance, for chaining.

Example

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

Examples

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

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

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc