3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-04 18:09:30 +01:00

load strings first

This commit is contained in:
reality 2013-04-20 00:09:47 +00:00
parent 0f6a486fe7
commit 44d42c5035

18
run.js
View File

@ -212,6 +212,15 @@ DBot.prototype.reloadModules = function() {
} }
}, this); }, this);
// Load string data for the module
_.each([ 'usage', 'strings' ], function(property) {
var propertyData = {};
try {
propertyData = JSON.parse(fs.readFileSync(moduleDir + property + '.json', 'utf-8'));
} catch(err) {};
_.extend(this[property], propertyData);
}, this);
// Load the module itself // Load the module itself
var rawModule = require(moduleDir + name); var rawModule = require(moduleDir + name);
var module = rawModule.fetch(this); var module = rawModule.fetch(this);
@ -263,15 +272,6 @@ DBot.prototype.reloadModules = function() {
}, this); }, this);
} }
// Load string data for the module
_.each([ 'usage', 'strings' ], function(property) {
var propertyData = {};
try {
propertyData = JSON.parse(fs.readFileSync(moduleDir + property + '.json', 'utf-8'));
} catch(err) {};
_.extend(this[property], propertyData);
}, this);
// Provide toString for module name // Provide toString for module name
module.toString = function() { module.toString = function() {
return this.name; return this.name;