CommandHandler

export declare class CommandHandler

Constructor

constructor(client: IgloClient, directory?: string): this;

Paramaters

nametypeoptionaldescription
clientIgloClientNo-
directorystringYes-

Properties

client: IgloClient

commands: Collection<string, Command<IgloClient>>

All the available commands

directory: string

registry: CommandRegistry

The registry handler responsible for registering all the commands

Methods

loadCommand(category, file)

function loadCommand(category: string, file: string): Promise<boolean>

Paramaters

nametypeoptionaldescription
categorystringNoThe category in which the file is located
filestringNoThe file name of the command

Description

Loads a command if not yet present in the cache

returns

Boolean depending on command presence in cache (true = already present)

throws

InterActionHandlerError

loadCommands()

function loadCommands(): Promise<number>

Description

Loads all the commands

returns

The amount of commands that were loaded

throws

InterActionHandlerError

reloadCommand(name)

function reloadCommand(name: string): Promise<boolean>

Paramaters

nametypeoptionaldescription
namestringNoThe name of the command

Description

Reloads a command

returns

Boolean depending on command presence in cache

throws

InterActionHandlerError

reloadCommands()

function reloadCommands(): Promise<void>

Description

Reloads all present commands

throws

InterActionHandlerError

unloadCommand(name)

function unloadCommand(name: string): boolean

Paramaters

nametypeoptionaldescription
namestringNoThe name of the command

Description

Unloads a command if present in the cache

returns

Boolean depending on command presence in cache