Bot
A Discord bot that has its own command registry, storage, utilities, etc.
Constructor Summary
Public Constructor | ||
public |
constructor(config: ConfigObject) |
Member Summary
Public Members | ||
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public get |
|
|
public |
|
|
public get |
|
|
public |
|
|
public |
|
Method Summary
Public Methods | ||
public |
buildCommand(info: CommandInfo, funcs: CommandBuilderFunctions): CommandBuilder Create a command builder |
|
public |
Instantiates all bot classes and storages, and creates the client |
|
public |
registerCommand(command: Command | function): Bot Registers a single command to the bot's registry |
|
public |
registerCommands(commands: Command[] | function[]): Bot Registers multiple commands to the bot's registry |
|
public |
registerDefaultCommands(options: Object): Bot Registers the default commands to the bot's registry |
|
public |
Registers the default modules to the bot's registry |
|
public |
Registers both the default modules and commands to the bot's registry |
|
public |
registerEvalObject(key: string, obj: Object): Bot Registers a single object to be usable by the eval command |
|
public |
registerEvalObjects(obj: Object): Bot Registers multiple objects to be usable by the eval command |
|
public |
registerModule(module: Module | function | string[]): Bot Registers a single module to the bot's registry |
|
public |
registerModules(modules: Module[] | function[] | Array[]): Bot Registers multiple modules to the bot's registry |
Public Constructors
public constructor(config: ConfigObject) source
Params:
Name | Type | Attribute | Description |
config | ConfigObject | The configuration to use |
Public Members
public dispatcher: CommandDispatcher source
public localStorage: LocalStorage source
public permissions: BotPermissions source
public get registry: CommandRegistry source
public storage: Object source
Properties:
Name | Type | Attribute | Description |
settings | SettingStorage | ||
modRoles | ModRoleStorage | ||
allowedChannels | AllowedChannelStorage |
Public Methods
public buildCommand(info: CommandInfo, funcs: CommandBuilderFunctions): CommandBuilder source
Create a command builder
Params:
Name | Type | Attribute | Description |
info | CommandInfo |
|
The command information |
funcs | CommandBuilderFunctions |
|
The command functions to set |
public createClient(): Client source
Instantiates all bot classes and storages, and creates the client
public registerCommand(command: Command | function): Bot source
Registers a single command to the bot's registry
public registerCommands(commands: Command[] | function[]): Bot source
Registers multiple commands to the bot's registry
public registerDefaultCommands(options: Object): Bot source
Registers the default commands to the bot's registry
Params:
Name | Type | Attribute | Description |
options | Object |
|
Object specifying what commands to register |
options.about | boolean |
|
Whether or not to register the built-in about command |
options.modRoles | boolean |
|
Whether or not to register the built-in mod roles commands |
options.channels | boolean |
|
Whether or not to register the built-in channels commands |
options.blacklist | boolean |
|
Whether or not to register the built-in blacklist commands |
public registerDefaults(): Bot source
Registers both the default modules and commands to the bot's registry
public registerEvalObject(key: string, obj: Object): Bot source
Registers a single object to be usable by the eval command
public registerEvalObjects(obj: Object): Bot source
Registers multiple objects to be usable by the eval command
Params:
Name | Type | Attribute | Description |
obj | Object | An object of keys: values |