Skip to main content

CommandHandler

A sub hub for creating and managing more customized commands.

warning

You should never have to construct this class yourself.

import { client } from 'beapi-core';

const newHandler = client.commands.createHandler(...);

Constructor​

new CommandHandler(client, cm, prefix);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
clientClient❌nullConstructed Client instance.
cmCommandManager❌nullConstructed CommandManager instance.
prefixstring❌nullPrefix to use.

Methods​

changePrefix​

Changes handlers prefix to something different.

changePrefix(prefix);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
prefixstring❌undefinedPrefix new handler should use.

Returns​

void


getPrefix​

Get handlers current prefix.

getPrefix();

Returns​

string


register​

Register a command with the default handler.

register(options, cb);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
optionsCommandOptions❌undefinedOptions for command.
cbCommandCallback❌undefinedCallback function called on usage.

Returns​

void


unregister​

Unregister a command on the default handler.

unregister(name);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
namestring❌undefinedName of the command.

Returns​

void


get​

Gets a command on the default handler.

get(name);
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
namestring❌undefinedName of the command.

Returns​

Command | undefined


getAll​

Gets all commands on the default handler.

getAll();

Returns​

Map<string, Command>