forked from embee/woomy
Update index.js
This commit is contained in:
parent
155eac0688
commit
b11f18b1a9
1 changed files with 15 additions and 13 deletions
26
index.js
26
index.js
|
@ -9,35 +9,35 @@ const client = new Discord.Client();
|
||||||
try {
|
try {
|
||||||
client.config = require('./config');
|
client.config = require('./config');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Could not load config.js. \n', err);
|
console.log('Could not load config.js: \n', err);
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
client.version = require('./version.json');
|
client.version = require('./version.json');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Could not load version.json. \n', err);
|
console.log('Could not load version.json: \n', err);
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
client.logger = require('./src/modules/Logger');
|
client.logger = require('./src/modules/Logger');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Could not load Logger.js. \n', err);
|
console.log('Could not load Logger.js: \n', err);
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
require("./src/modules/functions")(client);
|
require("./src/modules/functions")(client);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Could not load functions.js. \n', err);
|
console.log('Could not load functions.js: \n', err);
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
client.logger.setClient(client);
|
client.logger.setClient(client);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Logger failed to initialize. \n', err);
|
console.log('Logger failed to initialize: \n', err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,34 +45,36 @@ if(process.env['USER'] != 'container') {
|
||||||
client.devmode = true;
|
client.devmode = true;
|
||||||
} else {
|
} else {
|
||||||
client.devmode = false;
|
client.devmode = false;
|
||||||
|
if(client.config.dblkey.length == 0) {
|
||||||
const dblapi = new DBL(client.config.dblkey, client);
|
const dblapi = new DBL(client.config.dblkey, client);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
client.commands = new Enmap();
|
client.commands = new Enmap();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Failed to create the commands map. \n', err);
|
console.log('Failed to create the commands database: \n', err);
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
client.aliases = new Enmap();
|
client.aliases = new Enmap();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Failed to create the aliases map. \n', err);
|
console.log('Failed to create the aliases database: \n', err);
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
client.settings = new Enmap({name: 'settings'});
|
client.settings = new Enmap({name: 'settings'});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Failed to initialize the settings database. \n', err);
|
console.log('Failed to initialize the settings database: \n', err);
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
client.blacklist = new Enmap({name: 'blacklist'});
|
client.blacklist = new Enmap({name: 'blacklist'});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Failed to initialize the blacklist database. \n', err);
|
console.log('Failed to initialize the blacklist database: \n', err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +110,7 @@ const init = async () => {
|
||||||
client.levelCache[thisLevel.name] = thisLevel.level;
|
client.levelCache[thisLevel.name] = thisLevel.level;
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Level cache failed to initialize. \n', err);
|
console.log('Level cache failed to initialize: \n', err);
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,12 +121,12 @@ const init = async () => {
|
||||||
client.login(client.config.token);
|
client.login(client.config.token);
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Unable to login to Discord. \n', err);
|
console.log('Could not login to Discord: \n', err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
init();
|
init();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Initialization failed. \n', err);
|
console.log('Initialization failed: \n', err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue