3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 03:33:07 +01:00
This commit is contained in:
reality 2013-07-11 15:22:29 +00:00
parent e1b15b7376
commit 9379b73bdf

10
run.js
View File

@ -242,8 +242,6 @@ DBot.prototype.reloadModules = function() {
if(propertyKey) delete require.cache[propertyKey];
propertyObj = require(moduleDir + property).fetch(this);
} catch(err) {
this.status[name] = 'Error loading ' + propertyKey +
': ' + err + ' - ' + err.stack.split('\n')[1].trim();
console.log('Module error (' + module.name + ') in ' +
property + ': ' + err);
}
@ -282,7 +280,13 @@ DBot.prototype.reloadModules = function() {
var propertyData = {};
try {
propertyData = JSON.parse(fs.readFileSync(moduleDir + property + '.json', 'utf-8'));
} catch(err) {};
} catch(err) {
this.status[name] = 'Error loading ' + property +
': ' + err + ' - ' + err.stack.split('\n')[1].trim();
console.log('Data error (' + module.name + ') in ' +
property + ': ' + err);
};
_.extend(this[property], propertyData);
if(property == 'strings') {
_.each(_.keys(propertyData), function(string) {