SlashCommand

Represents a slash command on the API

Source: lib/src/SlashCommand.ts

Constructor

const command = new SlashCommand(options?);

Parameter

Optional

Type

Description

options

Yup

Object

An object specifying options for the command

options.name

Nope

String

A name for the command

options.description

Nope

String

A description for the command

options.options

Nope

Array

An array of ApplicationCommandOption objects

If you pass an options object to the constructor, it must have the properties defined above

Properties

Property

Type

Description

name

String

The command name

description

String

The command description

options

Array

The command options

Methods

setName<name: string>

Change the command name to the new one

setDescription<description: string>

Change the command description to the new one

addOption<option: ApplicationCommandOption>

Add another option to the command

addOptions<options: Array<ApplicationCommandOption>>

Add multiple options to the command

json

Convert the command object to a JSON payload that can be sent to the API

Last updated

Was this helpful?