3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 03:33:07 +01:00

~commands command [Close #491]

This commit is contained in:
reality 2013-06-05 22:26:10 +00:00
parent 3302298f45
commit f8768a7740
2 changed files with 21 additions and 0 deletions

View File

@ -17,6 +17,24 @@ var commands = function(dbot) {
}
},
'~commands': function(event) {
var name = event.params[1];
if(_.has(dbot.modules, name)) {
var commands = _.keys(dbot.commands);
commands = _.filter(commands, function(cName) {
return dbot.commands[cName].module == name;
});
event.reply(dbot.t('module_commands', {
'module': name,
'commands': commands.join(', ')
}));
} else {
event.reply(dbot.t('loaded_modules', {
'modules': _.keys(dbot.modules).join(', ')
}));
}
},
'~help': function(event) {
var moduleName = event.params[1];
if(!moduleName || !_.has(dbot.modules, moduleName)) {

View File

@ -48,5 +48,8 @@
"cy": "Modiwlau sy'n lwythodd: {modules}.",
"nl": "Geladen modules: {modules}.",
"de": "Module geladen: {modules}."
},
"module_commands": {
"en": "Commands in {module}: {commands}."
}
}