From f8768a7740249d82047e31e6900fc7ac7338aeaf Mon Sep 17 00:00:00 2001 From: reality Date: Wed, 5 Jun 2013 22:26:10 +0000 Subject: [PATCH] ~commands command [Close #491] --- modules/command/commands.js | 18 ++++++++++++++++++ modules/command/strings.json | 3 +++ 2 files changed, 21 insertions(+) diff --git a/modules/command/commands.js b/modules/command/commands.js index 5f5e079..5bf355b 100644 --- a/modules/command/commands.js +++ b/modules/command/commands.js @@ -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)) { diff --git a/modules/command/strings.json b/modules/command/strings.json index 3f531b1..3e6d5a0 100644 --- a/modules/command/strings.json +++ b/modules/command/strings.json @@ -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}." } }