Improved logging
This commit is contained in:
parent
91732c1b36
commit
5a75ec61f5
14
bot.js
14
bot.js
@ -31,7 +31,7 @@ client.on('ready', () => {
|
||||
logger.info(`Logged in as: ${client.user.tag}`);
|
||||
client.user.setPresence({ activity: { name: 'with dice | /roll' }})
|
||||
.then(logger.info)
|
||||
.catch(logger.error);
|
||||
.catch(er => logger.error(`Encountered error: ${JSON.stringify(er)}`));
|
||||
});
|
||||
|
||||
client.on('message', msg => {
|
||||
@ -69,9 +69,17 @@ client.on('message', msg => {
|
||||
}
|
||||
} catch (er) {
|
||||
msg.reply('Sorry, something went wrong.')
|
||||
logger.error(er);
|
||||
logger.error(`Encountered error: ${JSON.stringify(er)}`);
|
||||
}
|
||||
});
|
||||
|
||||
client.on('warn', warn => {
|
||||
logger.warn(`Warning: ${JSON.stringify(er)}`);
|
||||
});
|
||||
|
||||
client.on('error', er => {
|
||||
logger.error(`Error event triggered: ${JSON.stringify(er)}`);
|
||||
});
|
||||
|
||||
var auth = get_auth();
|
||||
client.login(auth.token)
|
||||
client.login(auth.token);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user