Add somewhat decent error handling finally

This commit is contained in:
hgw 2023-10-02 02:11:26 +00:00
parent 93370c7fe2
commit 1f0b700e82
2 changed files with 16 additions and 4 deletions

13
bot.js
View File

@ -134,11 +134,18 @@ fs.open('./config/usersettings.json','r',function(err, fd){
if(err) {
console.log(err);
}
console.log("usersettings.json did not exist, it has been created");
console.log("[main.setup] usersettings.json did not exist, it has been created");
});
fs.writeFileSync('./config/usersettings.json', "\{\n\}")
} else {
console.log("usersettings.json exists, continuing");
console.log("[main] usersettings.json exists, continuing");
}
});
console.log('[main.irc] Connecting to '+config.irc.server+'/'+config.irc.port+' as '+config.irc.nickname);
console.log('[main.irc] Connecting to '+config.irc.server+'/'+config.irc.port+' as '+config.irc.nickname);
process.on('uncaughtException', function (err) {
console.error(err);
if (config.errorhandling.log_errors_to_irc == 'true') {
bot.say(config.errorhandling.error_channel, errorMsg+" "+err.stack.split('\n',1).join(" "))
}
});

View File

@ -8,12 +8,17 @@
],
"nickname": "mercury",
"username": "mercury",
"realname": "git.supernets.org/hogwart7/mercury",
"realname": "git.supernets.org/hgw/mercury",
"autorejoin": "true",
"floodprotection": "false",
"floodprotectiondelay": "0",
"prefix": "m!"
},
"errorhandling": {
"error_logging": "true",
"error_channel": "#CHANNELTOSENDERRORSTO",
"error_channel_pass": ""
},
"colours": {
"date": "11",
"brackets": "15",