remove init function (async not needed)
This commit is contained in:
parent
2b05540e24
commit
e34d8cac57
17
bot/index.js
17
bot/index.js
|
@ -17,18 +17,23 @@ class WoomyClient extends Eris.Client {
|
|||
constructor (token, options) {
|
||||
super(token, options);
|
||||
|
||||
// Important information Woomy needs to access
|
||||
this.config = config;
|
||||
this.path = __dirname;
|
||||
this.version = version;
|
||||
|
||||
// Load up our command/event modules
|
||||
this.commandFiles = read('./commands').filter(file => file.endsWith('.js'));
|
||||
this.eventFiles = read('./event_modules').filter(file => file.endsWith('.js'));
|
||||
|
||||
// Essential modules
|
||||
this.logger = Logger;
|
||||
this.db = new Database(this);
|
||||
this.helpers = new Helpers(this);
|
||||
this.eventHandler = new EventHandler(this);
|
||||
// this.messageHandler = new messageHandler(this);
|
||||
|
||||
// Collections to store our successfully loaded commands and events in.
|
||||
this.commands = new Eris.Collection();
|
||||
this.aliases = new Eris.Collection();
|
||||
this.cooldowns = new Eris.Collection();
|
||||
|
@ -126,7 +131,6 @@ class WoomyClient extends Eris.Client {
|
|||
}
|
||||
}
|
||||
|
||||
async function init () {
|
||||
const client = new WoomyClient(config.token, {
|
||||
maxShards: 'auto',
|
||||
defaultImageFormat: 'png',
|
||||
|
@ -160,7 +164,14 @@ async function init () {
|
|||
}
|
||||
|
||||
client.connect();
|
||||
}
|
||||
|
||||
init ();
|
||||
// Process exception/promise rejection listeners
|
||||
|
||||
process.on('uncaughtException', (error) => {
|
||||
const errorMsg = error.stack.replace(new RegExp(`${client.path}/`, 'g'), './');
|
||||
client.logger.error('UNCAUGHT_EXCEPTION_ERROR', errorMsg);
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
client.logger.error('UNHANDLED_PROMISE_ERROR', err);
|
||||
});
|
Loading…
Reference in New Issue