CommandBuilder
CommandBuilder is used to construct a command for a Discord application, including type, name, description, and options.
Usage:
Properties
Type
CommandBuilder.Type :: table
An enumeration of command types.
- ChatInput: 1
- UserContextAction: 2
- MessageContextAction: 3
Context
CommandBuilder.Context :: table
An enumeration of command contexts.
- Guild: 0
- BotDM: 1
- PrivateChannel: 2
IntegrationType
CommandBuilder.IntegrationType :: table
An enumeration of command integration contexts.
- GuildCommand: 0
- UserCommand: 1
Methods
setType
CommandBuilder : setType () -> Builders.CommandBuilder
commandType: number
Sets the type of the command.
setLocalization
CommandBuilder : setLocalization () -> Builders.CommandBuilder
localizationCode: string
Sets the localization code for the command.
setDescription
CommandBuilder : setDescription () -> Builders.CommandBuilder
description: string
Sets the description of the command.
setName
CommandBuilder : setName () -> Builders.CommandBuilder
name: string
Sets the name of the command.
setNSFW
CommandBuilder : setNSFW () -> Builders.CommandBuilder
isNSFW: boolean
Sets whether the command is NSFW.
setGuildPermissions
CommandBuilder : setGuildPermissions () -> Builders.CommandBuilder
permissionObject: PermissionsBuilder
Sets the required permissions for the command in a guild.
addOption
CommandBuilder : addOption () -> Builders.CommandBuilder
commandObject: CommandOptionBuilder
Adds an option to the command.
addContext
CommandBuilder : addContext () -> Builders.CommandBuilder
context: number
Adds a context to the command.
addIntegration
CommandBuilder : addIntegration () -> Builders.CommandBuilder
integration: IntegrationType
Adds an intergration to the command.
toPayloadObject
CommandBuilder : toPayloadObject () -> Network.Resolvable
Converts the command to a JSON object that can be sent to the Discord API.
Functions
new
CommandBuilder . new () -> ()
Creates a new instance of CommandBuilder.