SlashCommand

The class containing a command's data.

Constructor

new SlashCommand(command, handler);

Parameter

Type

Required

Default

Description

command

true

none

The application command to be used

handler

true

none

The handler this command uses

Properties

id

The ID of this command. Type: string

application_id

The ID of the application. Type: string

name

This command's name Type: string

description

This command's description. Type: string

options

The options of this command. Type: ApplicationCommandOption | undefined

handler

The handler used. Type: SlashCommandHandler

functionMap

All the subcommand functions. Type: Map<string, InteractionFunction>

Methods

run(fn: InteractionFunction)

Set the main InteractionFunction. Returns: SlashCommand

run(option: string, fn: InteractionFunction)

The InteractionFunction for a specific option. Returns: SlashCommand

@DEPRECATED runSub(fn: InteractionFunction)

Run a sub command, for example: 'example ping user'. Returns: SlashCommand

parsedOptions(fn: InteractionFunction)

Set the main InteractionFunction. Returns: ApplicationCommandOption[]

toJSON()

Return this command as a stringified version used for sending patch requests. Returns: string

async save()

Send the request to save this command. Returns: void

async delete()

Send the request to delete this command. Returns: void

async create()

Send the request to create this command. Returns: void

Last updated

Was this helpful?