diff --git a/src/main.js b/src/main.js index 7f50755..2ebb883 100755 --- a/src/main.js +++ b/src/main.js @@ -1,19 +1,12 @@ require('./util'); +global.config = require('./config'); +if (config.testmode) console.log('TEST MODE'); global.exitHook = require('async-exit-hook'); global.Discord = require('discord.js'); global.fs = require('fs'); -global.config = require('./config'); global.dClient = new Discord.Client({ disableEveryone: true }); -process.on('unhandledRejection', (reason, promise) => { - console.error(promise); -}); -process.on('uncaughtException', error => { - console.error(error.stack); -}); - - (require('mongodb').MongoClient).connect(config.MONGODB_URI).then(client=>{ global.mdbClient = client; dClient.login(config.DISCORD_TOKEN); diff --git a/src/util.js b/src/util.js index a59d538..d4a59b5 100644 --- a/src/util.js +++ b/src/util.js @@ -1,3 +1,10 @@ +process.on('unhandledRejection', (reason, promise) => { + console.error(promise); +}); +process.on('uncaughtException', error => { + console.error(error.stack); +}); + Array.prototype.random = function () { return this[Math.floor(Math.random() * this.length)] } \ No newline at end of file