Plugin improvements and JSDoc

This commit is contained in:
Isaac
2021-02-17 20:17:35 +00:00
parent 7e67161cf1
commit 14d7c32742
6 changed files with 222 additions and 25 deletions

View File

@@ -66,6 +66,7 @@ const log = new Logger({
const I18n = require('@eartharoid/i18n');
const { CommandManager } = require('./modules/commands');
const { PluginManager } = require('./modules/plugins');
const {
Client,
@@ -84,20 +85,29 @@ class Bot extends Client {
intents: Intents.NON_PRIVILEGED,
}
});
Object.assign(this, {
commands: new CommandManager(this),
config,
db: require('./database')(log), // this.db.models.Ticket...
log,
i18n: new I18n(path('./src/locales'), 'en-GB')
});
/** The global bot configuration */
this.config= config;
/** A sequelize instance */
this.db = require('./database')(log), // this.db.models.Ticket...
/** A leekslazylogger instance */
this.log = log;
/** An @eartharoid/i18n instance */
this.i18n = new I18n(path('./src/locales'), 'en-GB');
// set the max listeners for each event to the number in the config
this.setMaxListeners(this.config.max_listeners);
// check for updates
require('./updater')(this);
// load internal listeners
require('./modules/listeners')(this);
require('./modules/plugins')(this);
/** The command manager, used by internal and plugin commands */
this.commands = new CommandManager(this);
/** The plugin manager */
this.plugins = new PluginManager(this);
// load plugins
this.plugins.load();
this.log.info('Connecting to Discord API...');