Added client.on for errors, warnings, etc. Errors will force reset the bot.

This commit is contained in:
chris062689@gmail.com 2018-09-06 21:10:21 -04:00
parent 28fda1e526
commit 07297c761c

View File

@ -41,6 +41,24 @@ client.on('ready', () => {
logger.info('Bot is now online and connected to server.');
});
client.on('error', (x) => {
logger.error(x)
logger.error('Restarting process.')
process.exit(1)
})
client.on('warn', (x) => {
logger.warn(x)
})
client.on('debug', (x) => null)
client.on('disconnect', () => {
logger.warn('Disconnected from Discord server.');
})
client.on('reconnecting', () => {
logger.warn('Reconnecting...');
})
client.on('guildMemberAdd', (member) => {
member.addRole(process.env.DISCORD_RULES_ROLE);
state.stats.joins += 1;