SlashCommandBuilder
BuilderOn this page
SlashCommandBuilder is a fluent payload builder. Chain setters, then pass the builder to send, reply, or command registration.
Constructor
SlashCommandBuilder.new() The class table is callable, so SlashCommandBuilder() is the same as .new.
No parameters.
local discord = require("discord")
local object = discord.SlashCommandBuilder()Properties
- 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
| Name | Type | Required | Behavior |
|---|---|---|---|
input |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addAttachmentOption(input)SlashCommandBuilder:addBooleanOption()
#Add BooleanOption to this SlashCommandBuilder.
Signature
SlashCommandBuilder:addBooleanOption(input) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
input |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addBooleanOption(input)SlashCommandBuilder:addChannelOption()
#Add ChannelOption to this SlashCommandBuilder.
Signature
SlashCommandBuilder:addChannelOption(input) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
input |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addChannelOption(input)SlashCommandBuilder:addIntegerOption()
#Add IntegerOption to this SlashCommandBuilder.
Signature
SlashCommandBuilder:addIntegerOption(input) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
input |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addIntegerOption(input)SlashCommandBuilder:addMentionableOption()
#Add MentionableOption to this SlashCommandBuilder.
Signature
SlashCommandBuilder:addMentionableOption(input) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
input |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addMentionableOption(input)SlashCommandBuilder:addNumberOption()
#Add NumberOption to this SlashCommandBuilder.
Signature
SlashCommandBuilder:addNumberOption(input) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
input |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addNumberOption(input)SlashCommandBuilder:addRoleOption()
#Add RoleOption to this SlashCommandBuilder.
Signature
SlashCommandBuilder:addRoleOption(input) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
input |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addRoleOption(input)SlashCommandBuilder:addStringOption()
#Add StringOption to this SlashCommandBuilder.
Signature
SlashCommandBuilder:addStringOption(input) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
input |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addStringOption(input)SlashCommandBuilder:addSubcommand()
#Add Subcommand to this SlashCommandBuilder.
Signature
SlashCommandBuilder:addSubcommand(input) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
input |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addSubcommand(input)SlashCommandBuilder:addSubcommandGroup()
#Add SubcommandGroup to this SlashCommandBuilder.
Signature
SlashCommandBuilder:addSubcommandGroup(input) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
input |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a SlashCommandBuilder
object:addSubcommandGroup(input)SlashCommandBuilder:addUserOption()
#Add UserOption to this SlashCommandBuilder.
Signature
SlashCommandBuilder:addUserOption(input) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
input |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
permissions |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
description |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
localizations |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
enabled |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
name |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
localizations |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
nsfw |
any |
required | Passed through to the implementation as written. |
Returns
SlashCommandBuilder — the same instance, for chaining.
Example
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
local discord = require("discord")
-- object is a SlashCommandBuilder
object:toJSON()Examples
local discord = require("discord")
local object = discord.SlashCommandBuilder({})Related APIs
ActionRowBuilder · AttachmentBuilder · ButtonBuilder · ChannelSelectMenuBuilder · CheckboxBuilder · ContainerBuilder · ContextMenuCommandBuilder · EmbedBuilder
Version: discord 1.2.4 · runtime 1.0.0