Command properties may be specified in module config file [#125]

This commit is contained in:
reality 2013-01-12 10:07:39 +00:00
parent 6b903407ed
commit 20ef3b6432

12
run.js
View File

@ -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;