From 44d42c50355375f2d5adad5c986449556a591418 Mon Sep 17 00:00:00 2001 From: reality Date: Sat, 20 Apr 2013 00:09:47 +0000 Subject: [PATCH] load strings first --- run.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/run.js b/run.js index 78cc69d..fa584e7 100644 --- a/run.js +++ b/run.js @@ -212,6 +212,15 @@ DBot.prototype.reloadModules = function() { } }, 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 var rawModule = require(moduleDir + name); var module = rawModule.fetch(this); @@ -262,16 +271,7 @@ DBot.prototype.reloadModules = function() { this.instance.addListener(on, module.name, module.listener); }, 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 module.toString = function() { return this.name;