Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Command

Hierarchy

  • Command

Implements

  • CommandType

Index

Constructors

constructor

  • new Command(data: CommandType): Command

Properties

args

args: Argument[] = ...

An array of options for the command. type of class Argument[]

description

description: string = 'This command has no description'

Optional guild

guild?: string

The guild for the command to be registered in. If left blank, the command will be registered as a global command.

id

id: string

The id of the application command

name

name: string

The display name of the slash interaction. Must be all lowercase.

run

run: CommandCallback

subCommands

subCommands: SubCommand[] = ...

Methods

addArg

addSubCommand

  • addSubCommand(...args: SubCommand[]): Command

mount

  • mount(): Promise<ApplicationCommandCreateUpdateDelete>

toJSON

  • toJSON(): ApplicationCommandCreate

toString

  • toString(): string

Static from

  • from<T>(cmd: ApplicationCommandCreateUpdateDelete, run: T extends true ? CommandCallback : undefined, mount?: T): Command
  • Convert a slash command into a actual command

    Type parameters

    • T: boolean

    Parameters

    • cmd: ApplicationCommandCreateUpdateDelete

      The command you want to convert

    • run: T extends true ? CommandCallback : undefined

      The callback for the command. This is required if mount is true

    • Optional mount: T

      if the command should mount or not, the callback is required if so. defaults to false

    Returns Command

    a new Command