An abstract base command class. You should probably not extend this yourself and instead should extend RegularCommand or SlashCommand.

Type Parameters

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

    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.

    • trigger: T

      The message or interaction that triggered this command.

    Returns Promise<void | Message<boolean>>

    A promise that resolves the message that was replied to the original message author (if available).

    Emits

    client#commandError

Generated using TypeDoc