An abstract message based command class. Extend this class to define your command's functionality. This class serves as a base for message based commands. You should always prefer to use SlashCommand instead of this one.

Hierarchy

Constructors

Properties

aliases: string[]

Aliases for this command.

Memberof

Command

Default Value

[]

The client that this command will be used by.

Memberof

Command

description: string

The description of this command.

Memberof

Command

emoji: string

The emoji of this command. This is used by the default HelpSlashCommand.

Memberof

Command

Default Value

🤖

group: null | CommandGroup

The group that this command is registered to.

Remarks

This gets initialized on command registration.

Memberof

Command

groupID: string

The ID of the group that this command is registered to.

Memberof

Command

guildOnly: boolean

Whether this command may only be used in a guild.

Memberof

Command

Default Value

false

name: string

The name of this command.

Memberof

Command

nsfw: boolean

Whether this command may only be used in a NSFW channel.

Memberof

Command

Default Value

false

ownerOnly: boolean

Whether this command may only be used by the bot's owner.

Memberof

Command

Default Value

false

ownerOverride: boolean

Whether the bot's owner can execute this command even if they don't have the required permissions.

Memberof

Command

Default Value

true

userPermissions: null | PermissionResolvable

The permissions resolvable that defines the permissions that a user requires to execute this command.

Memberof

Command

Default Value

null

Methods

  • Check whether the message author can execute this command.

    Parameters

    • message: Message<boolean>

      The message that triggered this command.

    Returns string | boolean

    true if the user has enough permissions, or a string with the reason why they cannot execute this command.

  • Handle command error.

    Parameters

    • error: unknown

      The error that was thrown inside the command's run method.

    • message: Message<boolean>

      The message that triggered this command.

    Returns Promise<void>

    Emits

    client#commandError

  • Abstract method. You need to implement this method in order for the command to work. This defines the execution behavior of the command.

    Parameters

    • message: Message<boolean>

      The message that triggered this command.

    • args: string[]

      The arguments passed to this command.

    Returns Promise<void>

Generated using TypeDoc