Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Methods

Static Private getSnowflake

  • getSnowflake(from: string | Message | User | GuildMember): string
  • Get a user ID from different sources, only here to simplify code.

    internal

    Parameters

    • from: string | Message | User | GuildMember

      Where to get ID from.

    Returns string

    • The ID.

deleteMessage

execute

getCooldown

  • getCooldown(from: string | Message | User | GuildMember): Cooldown
  • 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 | Message | User | GuildMember

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

    Returns Cooldown

    • The user's cooldown.

getInvalidPermissions

  • getInvalidPermissions(): { client: string[]; user: string[] }

getMissingPermissions

getMissingTags

  • 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.

isInCooldown

  • isInCooldown(from: string | Message | User | GuildMember): boolean
  • Returns true if the user is in a cooldown for this command.

    remarks

    If cooldown not set, this will always return false.

    Parameters

    • from: string | Message | User | GuildMember

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

    Returns boolean

    • Is user in a cooldown.

isInRightChannel

Optional registerSubCommands

  • registerSubCommands(): any

Abstract run

  • The function to run when executing the command.

    remarks

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

    Parameters

    Returns any

setCooldown

  • setCooldown(from: string | Message | User | GuildMember): void
  • Put all the required properties in CommandHandler.cooldowns plus the setTimeout to remove the user from the cooldowns.

    Parameters

    • from: string | Message | User | GuildMember

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

    Returns void

signature

  • Get the signature of this command.

    example

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

    help [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.

signatures

  • Returns the signature of the command plus the signature of the subCommands of this command.

    example

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

    help [command]
    help all
    

    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.

validate

Protected subCommand

Properties

Optional aliases

aliases: string[]

The aliases of the command.

arguments

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.

Optional category

category: string

The category of the command.

defaultvalue

The command parent directory.

Optional channels

channels: (string | TextChannel)[]

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

Optional clientPermissions

clientPermissions: string[]

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

defaultvalue

['SEND_MESSAGES']

Optional cooldown

cooldown: number

The cooldown of the command in seconds.

defaultvalue

0

remarks

Every cooldown should be saved in CommandHandler.cooldowns.

Optional description

description: string

The description of the command.

Readonly Abstract name

name: string

The name of the command.

subCommands

subCommands: SubCommand[] = []

The SubCommands of this command.

remarks

Register SubCommands using the {@link Command#registerSubCommands} method.

Optional tags

tags: string[]

The tags of the command.

remarks

How tags works ?

see

Tag

Optional usage

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 {@link Command#signatures} method.

Optional userPermissions

userPermissions: string[]

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

defaultvalue

['SEND_MESSAGES']

Constructors

constructor

Accessors

nameAndAliases

  • get nameAndAliases(): string[]

subCommandsNamesAndAliases

  • get subCommandsNamesAndAliases(): string[]

Generated using TypeDoc