Options
All
  • Public
  • Public/Protected
  • All
Menu

The Commander singleton handles the calling of and treatment of call command objects, nominally only one of these should exist at any given moment.

Hierarchy

  • Commander

Index

Properties

Private aliasList

aliasList: object

This object will be temporarily used to store the aliases of commands

Private callList

callList: object

This final list will be used to call all commands with their names and aliases

Private Readonly commandList

commandList: any = commandList

A list of references to command classes exported by index.ts in the commands directory

Private nameList

nameList: object

This object will be temporarily used to store the names of commands, as opposed to aliases

Methods

Private createLists

  • createLists(): Promise<false>
  • This function takes care of setting up the actual lists of command names and aliases The function instantiates all Classes found in the commandList property one by one to return their properties

    Returns Promise<false>

    Promise - returns true when all lists have been created, returns false if an error occurs

getList

  • getList(): object
  • Returns the list of commands and aliases, mostly for the Help command

    Returns object

    object - the list of commands and aliases

Private handleError

  • A function to handle errors a command might return

    Parameters

    Returns void

Private handleWarning

  • handleWarning(comm: Command): void
  • A separate function to handle warnings a command might emit

    Parameters

    Returns void

register

  • register(): Promise<boolean>
  • A simple function to register all command names and aliases, unfortunately this function has to be called after

    remark

    object instantiation as it requires the Settings object to be instantiated

    Returns Promise<boolean>

    boolean - true if successful, false if an error occurs

Private registerAlias

  • registerAlias(Alias: any, CommandName: any, command: any): boolean
  • Registers Command Classes with their aliases and checks for duplicates If an alias already exists as a command name it will not be added If an alias has been registered before it will not be registered

    Parameters

    • Alias: any
    • CommandName: any
    • command: any

    Returns boolean

Private registerName

  • registerName(Name: any, command: any): void
  • Registers a Command Class by it's name property

    Parameters

    • Name: any
    • command: any

    Returns void

run

  • run(command: string, message: Message): void
  • This wrapper function will be called to run the actual command after a prefix has been detected This handles both the calling of the command, returning it's reply in chat, and handling it's errors

    Parameters

    • command: string

      the name of the command to be called

    • message: Message

      the discordjs Message object of the message in which the command was called

    Returns void

Legend

  • Variable
  • Function
  • Class
  • Method
  • Private property
  • Private method
  • Interface

Generated using TypeDoc