new Bot(botOptions: BotOptions, clientOptions?: ClientOptions)
The Discord.js Client instance. Contains bot-specific
storage
,
guild specific storages
, and contains important
fields for access within commands
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
botOptions |
|
Object containing required bot properties | |
clientOptions |
|
<optional> |
Discord.js ClientOptions |
Extends
Events
command
Emitted whenever a command is successfully called
Parameters:
Name | Type | Description |
---|---|---|
name |
|
Name of the called command |
args |
|
Args passed to the called command |
original |
|
Original content of the message that called the command |
execTime |
|
Time command took to execute |
message |
|
Message that triggered the command |
Properties
.commands: CommandRegistry<string, Command>
.commandsDir: string
.config: Object
Object containing token and owner ids
Type:
Properties:
Name | Type | Description |
---|---|---|
token |
|
Discord login token for the bot |
owner |
|
Array of owner id strings |
.disableBase: Array<string>
Array of base command names to skip when loading commands. Base commands
may only be disabled by name, not by alias
Type:
.guildStorages: GuildStorageRegistry<string, GuildStorage>
.name: string
The name of the Bot
Type:
.noCommandErr: string
Whether or not a generic 'command not found' message
should be given in DMs to instruct the user to
use the `help` command. Set to false to disable
this message
Type:
.passive: boolean
Whether or not this bot is passive. Passive bots
will not register a command dispatcher or a message
listener. This allows passive bots to be created that
do not respond to any commands but are able to perform
actions based on whatever the framework user wants
Type:
.readyText: string
Text to output when the bot is ready
Type:
.selfbot: boolean
Whether or not the bot is a selfbot
Type:
.statusText: string
Status text for the bot
Type:
.storage: LocalStorage
.version: string
Bot version, best taken from package.json
Type:
Methods
.defaultSettingExists(key: string) → boolean
See if a guild default setting exists
Parameters:
Name | Type | Description |
---|---|---|
key |
|
The key in storage to check |
.getPrefix(guild: Guild) → string|null
Shortcut to return the command prefix for the provided guild
Parameters:
Name | Type | Description |
---|---|---|
guild |
|
The guild or guild id to get the prefix of |
.loadCommand(command: string)
Loads/reloads all/specific commands
Parameters:
Name | Type | Description |
---|---|---|
command |
|
The name of a command to reload, or 'all' to load all commands |
.removeDefaultSetting(key: string) → Bot
Remove a defaultGuildSettings item. Will not remove from ALL guild
settings, but will prevent the item from being added to new guild
settings storage upon creation
Parameters:
Name | Type | Description |
---|---|---|
key |
|
The key to use in settings storage |
.setDefaultSetting(key: string, value: string) → Bot
Set the value of a default setting key and push it to all guild
setting storages. Will not overwrite a setting in guild settings
storage if there is already an existing key with the given value
Parameters:
Name | Type | Description |
---|---|---|
key |
|
The key to use in settings storage |
value |
|
The value to use in settings storage |
.start() → Bot
.sweepStorages()
Clean out any guild storage/settings that no longer have
an associated guild