Class SlowCommandAbstract

Hierarchy (view full)

Constructors

Properties

aliases?: string[]

The aliases of the command.

arguments: Record<string, Argument<any>> = {}

The arguments of the command. You can put your own custom arguments but you must add the type to the argument types.

category?: string

The category of the command.

Default Value

The command parent directory.
channels?: (string | TextChannel)[]

The channels where the command should only be executed if used (if using the default message event).

clientPermissions?: string[]

The client permissions needed to run the command (if using the default message event).

Default Value

['SEND_MESSAGES']

cooldown?: number

The cooldown of the command in seconds.

Default Value

0

Remarks

Every cooldown should be saved in CommandHandler.cooldowns.

description?: string

The description of the command.

name: string

The name of the command.

subCommands: SubCommand[] = []

The SubCommands of this command.

Remarks

Register SubCommands using the Command#registerSubCommands method.

tags?: string[]

The tags of the command.

Remarks

How tags works ?

See

Tag

usage?: string

The usage of the command.

Example

userinfo
userinfo me
userinfo <ID/Username/Mention of User>

Remarks

If no value is set, in most places it will use the result of the Command#signatures method.

userPermissions?: string[]

The user permissions needed to run the command (if using the default message event).

Default Value

['SEND_MESSAGES']

waitEmoji: string = ':hourglass_flowing_sand:'

The emoji for waiting.

Remarks

Feel free to modify the emoji to use a custom one.

Accessors

  • get nameAndAliases(): string[]
  • Returns the names and aliases of this command in an array.

    Returns string[]

  • get subCommandsNamesAndAliases(): string[]
  • Returns the names and aliases of the subCommands of this command in an array flatted.

    Returns string[]

Methods

  • Deletes a message if deletable.

    Parameters

    Returns undefined | Promise<Message<boolean>> | Timeout

    • If not deletable nothing, else the deleted message or the Node.js Timer if a timeout is set.
  • Execute the run method, but perform validations before, prefer using this method in your custom Message Event.

    Parameters

    Returns Promise<undefined | CommandError>

    • An error related to the command if any, for example : a tag not satisfied.
  • Get the actual cooldown of the user for this command plus when command has been executed and how many seconds to wait.

    Parameters

    • from: string | User | GuildMember | Message<boolean>

      Where to get the cooldown from, can be a user/guild/message, see types.

    Returns Cooldown

    • The user's cooldown.
  • Internal

    Returns the invalid permissions (not presents in Permissions.FLAGS).

    Returns {
        client: string[];
        user: string[];
    }

    • client: string[]
    • user: string[]
  • Gives the tags of this command which are not validated by the context.
    i.e. If a command is executed on a guild and the command has the dmOnly Tag, it will be returned.

    Parameters

    Returns Tag[]

    • Tags that are not validated by the message.
  • Returns true if the user is in a cooldown for this command.

    Parameters

    • from: string | User | GuildMember | Message<boolean>

      From where to test if user/guild/message is in a cooldown, see types.

    Returns boolean

    • Is user in a cooldown.

    Remarks

    If cooldown not set, this will always return false.

  • Returns false if channels are defined for this command but the message doesn't come from one of it.

    Parameters

    Returns boolean

    • If it is on a channel required if used.
  • Override this method to register your subCommands.

    Returns any

  • The function to run when executing the command.

    Parameters

    Returns any

    Remarks

    Use the Command#execute method if you want to have a validation before executing the run method.

  • Put all the required properties in CommandHandler.cooldowns plus the setTimeout to remove the user from the cooldowns.

    Parameters

    • from: string | User | GuildMember | Message<boolean>

      What to use to select the user to set the cooldown from, can be a guild/message/member.

    Returns void

  • Get the signature of this command.

    Parameters

    • Optional options: CommandSignatureOptions

      The options for the signature, show the type of the arguments or the default values.

    Returns string

    • The signature of this command or subCommand.

    Example

    // The help command with an optional command commandArgument argument.

    help [command]
    
  • Returns the signature of the command plus the signature of the subCommands of this command.

    Parameters

    • Optional options: CommandSignatureOptions

      The options for the signature, show the type of the arguments or the default values.

    Returns string

    • The signatures of the command.

    Example

    // The help command with an optional command commandArgument argument and a all subCommand with no arguments.

    help [command]
    help all
  • Reacts with the waitEmoji.

    Parameters

    Returns Promise<void>

  • Remove the reaction waitEmoji of the bot.

    Parameters

    Returns Promise<void>

  • Validate a command, returning an error if any of the validation methods are not valid.

    Parameters

    Returns Promise<undefined | CommandErrorBuilder>

    • The error if any.

Generated using TypeDoc