Home Manual Reference Source Repository
import CommandRegistry from 'discord-graf/src/commands/registry.js'
public class | source

CommandRegistry

Extends:

events~EventEmitter → CommandRegistry

Handles registration and searching of commands and modules

Constructor Summary

Public Constructor
public

constructor(logger: Logger)

Member Summary

Public Members
public
public
public

Method Summary

Public Methods
public

findCommands(searchString: string, message: Message): Command[]

Finds all commands that match the search string

public

findModules(searchString: string): Module[]

Finds all modules that match the search string

public

Registers a single command

public

registerCommands(commands: Command[])

Registers multiple commands

public

Registers a single module

public

registerModules(modules: Module[])

Registers multiple modules

Public Constructors

public constructor(logger: Logger) source

Params:

NameTypeAttributeDescription
logger Logger
  • optional
  • nullable: true

The logger to use

Public Members

public commands: Command[] source

public logger: Logger source

public modules: Module[] source

Public Methods

public findCommands(searchString: string, message: Message): Command[] source

Finds all commands that match the search string

Params:

NameTypeAttributeDescription
searchString string
  • optional

The string to search for

message Message
  • optional

The message to check usability against

Return:

Command[]

All commands that are found

public findModules(searchString: string): Module[] source

Finds all modules that match the search string

Params:

NameTypeAttributeDescription
searchString string
  • optional

The string to search for

Return:

Module[]

All modules that are found

public registerCommand(command: Command) source

Registers a single command

Params:

NameTypeAttributeDescription
command Command

The command to register

See:

public registerCommands(commands: Command[]) source

Registers multiple commands

Params:

NameTypeAttributeDescription
commands Command[]

The commands to register

Emit:

*

commandRegister When a command is registered, with the command and registry passed

public registerModule(module: Module) source

Registers a single module

Params:

NameTypeAttributeDescription
module Module

The module to register

See:

public registerModules(modules: Module[]) source

Registers multiple modules

Params:

NameTypeAttributeDescription
modules Module[]

The modules to register

Emit:

*

moduleRegister When a module is registered, with the module and registry passed