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) {
|
'~help': function(event) {
|
||||||
var moduleName = event.params[1];
|
var moduleName = event.params[1];
|
||||||
|
if(!moduleName) {
|
||||||
|
event.reply(dbot.t('usage', {
|
||||||
|
'command': '~help',
|
||||||
|
'usage': '~help [module]'
|
||||||
|
}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!_.has(dbot.modules, moduleName)) {
|
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')) {
|
if(moduleName && _.has(dbot.config[moduleName], 'help')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user