Create usersettings.json if it does not exist
This commit is contained in:
parent
d573bec6ad
commit
52f31805d6
15
bot.js
15
bot.js
@ -128,4 +128,17 @@ bot.addListener('error', function(message) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log('[main] Starting Mercury');
|
console.log('[main] Starting Mercury');
|
||||||
console.log('[main.irc] Connecting to '+config.irc.server+'/'+config.irc.port+' as '+config.irc.nickname)
|
fs.open('./config/usersettings.json','r',function(err, fd){
|
||||||
|
if (err) {
|
||||||
|
fs.writeFile('./config/usersettings.json', '', function(err) {
|
||||||
|
if(err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
console.log("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.irc] Connecting to '+config.irc.server+'/'+config.irc.port+' as '+config.irc.nickname);
|
Loading…
Reference in New Issue
Block a user