forked from GitHub/dbot
adding some extra checks to ~help command to prevent errors
This commit is contained in:
parent
9b7098a318
commit
163209afb9
@ -18,8 +18,20 @@ var commands = function(dbot) {
|
||||
|
||||
'~help': function(event) {
|
||||
var moduleName = event.params[1];
|
||||
if(!moduleName) {
|
||||
event.reply(dbot.t('usage', {
|
||||
'command': '~help',
|
||||
'usage': '~help [module]'
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!_.has(dbot.modules, moduleName)) {
|
||||
var moduleName = dbot.commands[moduleName].module;
|
||||
if(_.has(dbot.commands, moduleName)) {
|
||||
var moduleName = dbot.commands[moduleName].module;
|
||||
} else {
|
||||
var moduleName = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if(moduleName && _.has(dbot.config[moduleName], 'help')) {
|
||||
|
Loading…
Reference in New Issue
Block a user