Options
All
  • Public
  • Public/Protected
  • All
Menu

Command is an abstract class that should be extended to make your own custom command. It also needs to be exported as default when using registerCommands.

Hierarchy

Index

Constructors

Properties

aliases: string[] = []

Array of aliases for the command. This is optional, you can omit this if you don't want any aliases for a particular command.

block: boolean = false

Blocks command if there's already an instance of it running under the same user

commandManager: CommandManager

Access to CommandManager

cooldown?: Duration

Cooldown time

description?: string

Add command description

disable: boolean = false

Disable command.

name: string

Command name. This will be used to identify command.

permissions: PermissionResolvable[] = []

Required permissions to run this command

postExec: ((msg: Message<boolean>, args?: string[]) => unknown)[] = []

Runs all functions in the array after Command#exec is executed

preExec: ((msg: Message<boolean>, args?: string[]) => unknown)[] = []

Runs all functions in the array before Command#exec is executed

usageBeforeCooldown: number = 1

How many usages before command starts cooldown

Methods

  • exec(msg: Message<boolean>, args?: string[]): unknown
  • This is where your main logic should reside for a particular command.

    Parameters

    • msg: Message<boolean>

      Discord.js Message object

    • Optional args: string[]

      Space seperated arguments

    Returns unknown

  • execute(msg: Message<boolean>, args: string[]): unknown
  • Executes command regardless if argument list is needed.

    Parameters

    • msg: Message<boolean>

      Discord.js Message object

    • args: string[]

      Space seperated arguments

    Returns unknown

  • send(msg: Message<boolean>, text: string): Promise<Message<boolean>>
  • Helper method to wrap a text message to an embed message and send it.

    Parameters

    • msg: Message<boolean>

      Discord.js Message object

    • text: string

      Text message to be sent

    Returns Promise<Message<boolean>>

  • sendEmbed(msg: Message<boolean>, embed: MessageEmbed): Promise<Message<boolean>>
  • Helper method to send an embed messsage.

    Parameters

    • msg: Message<boolean>

      Discord.js Message object

    • embed: MessageEmbed

      Discord.js MessageEmbed object

    Returns Promise<Message<boolean>>

Generated using TypeDoc