forked from GitHub/dbot
Command properties may be specified in module config file [#125]
This commit is contained in:
parent
6b903407ed
commit
20ef3b6432
12
run.js
12
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;
|
||||
|
Loading…
Reference in New Issue
Block a user