From 20ef3b64322cd823785d23bd9584f413823e9ed0 Mon Sep 17 00:00:00 2001 From: reality Date: Sat, 12 Jan 2013 10:07:39 +0000 Subject: [PATCH] Command properties may be specified in module config file [#125] --- run.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/run.js b/run.js index e83dbac..22e7e0b 100644 --- a/run.js +++ b/run.js @@ -161,6 +161,7 @@ DBot.prototype.reloadModules = function() { try { // Load the module config data + var config = {}; try { var config = JSON.parse(fs.readFileSync(moduleDir + 'config.json', 'utf-8')) this.config[name] = config; @@ -206,6 +207,17 @@ DBot.prototype.reloadModules = function() { } } + // Load module commands with properties specified in config + if(module.commands && config.commands) { + for(key in config.commands) { + if(newCommands.hasOwnProperty(key)) { + for(var prop in config.commands[key]) { + newCommands[key][prop] = config.commands[key][prop]; + } + } + } + } + // Load module web bits if(module.pages) { var newpages = module.pages;