Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

CommandHandlerEvents

CommandHandlerEvents: { create: [CreateCommandHandlerOptions]; error: [CommandHandlerError]; launch: [LaunchCommandHandlerOptions]; launched: []; loadCommand: [Command]; loadEvent: [Event] }

The CommandHandler events.

see

EventEmitter.

Type declaration

CooldownUser

CooldownUser: {}
internal

Type declaration

Variables

Let client

client: AdvancedClient | null = null

The client of the handler, null before launch function executed.

Const commands

commands: Collection<string, Command> = ...

The commands registered by the CommandHandler.

Let commandsDir

commandsDir: string = ''

Const cooldowns

cooldowns: Collection<string, CooldownUser> = ...

The cooldowns mapped by ID and cooldown user.

A simple explication :
When a user executes a command with a cooldown, a new value is added.

[anyID]: {
   [commandName]: {
       executedAt: Date,
       cooldown: [command cooldown]
   }
}

So cooldowns are mapped by IDs (can be anything, user IDs recommended) then mapped by commands.

Const emitter

emitter: EventEmitter = ...

The event emitter for the CommandHandler.

eventproperty

Const events

events: Collection<string, Event> = ...

The events registered by the EventHandler.

remarks

These events may not be bound to the client.

Let eventsDir

eventsDir: string = ''

Let owners

owners: string[] = []

Let prefixes

prefixes: string[] = []

Let presencesInterval

presencesInterval: NodeJS.Timer

The interval of the cycling presences, undefined if you don't use it.

Const version

version: any = ...

The version of the handler.

Functions

create

emit

findCommand

  • findCommand(name: string): undefined | Command
  • Find a command by name or alias.

    Parameters

    • name: string

      The name or alias of the command.

    Returns undefined | Command

    • The command found or undefined.

getCommandAliasesAndNames

  • getCommandAliasesAndNames(): string[]
  • Returns the list of names and aliases of all commands, useful to find a command by name.

    Returns string[]

    • All the names and aliases in a flat array.

getPrefixFromMessage

  • getPrefixFromMessage(message: Message): undefined | string

launch

loadCommand

  • loadCommand(path: string, name: string): Promise<Command>
  • Load a command from the directory & filename.

    Parameters

    • path: string

      The path of the command folder.

    • name: string

      The name of the command including the extension.

    Returns Promise<Command>

    • The command itself.

loadCommands

  • loadCommands(path: string): Promise<void>
  • Load all the commands from a directory.

    remarks

    The path must be a directory containing sub-directories.

    Parameters

    • path: string

      The path of the directory to load the commands from.

    Returns Promise<void>

loadEvent

  • loadEvent(path: string, name: string): Promise<Event>
  • Load an event from the directory and filename.

    Parameters

    • path: string

      The path of the event folder.

    • name: string

      The name of the event including the extension.

    Returns Promise<Event>

    • The event itself.

loadEvents

  • loadEvents(path: string): Promise<void>
  • Load all the events from a directory.

    Parameters

    • path: string

      The path of the directory to load the events from.

    Returns Promise<void>

on

once

unloadCommand

  • unloadCommand(name: string): void

unloadEvent

  • unloadEvent(name: string): void

useDefaultCommands

  • useDefaultCommands(options?: DefaultCommandsOptions): typeof CommandHandler

useDefaultEvents

  • useDefaultEvents(options?: DefaultEventsOptions): typeof CommandHandler

Generated using TypeDoc