mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
[
This commit is contained in:
parent
84bd092bae
commit
be23d97293
@ -17,5 +17,6 @@
|
|||||||
"language": "en",
|
"language": "en",
|
||||||
"debugMode": false,
|
"debugMode": false,
|
||||||
"debugLevel": 1,
|
"debugLevel": 1,
|
||||||
|
"repoRoot": "https://github.com/reality/depressionbot/",
|
||||||
"version": "Depressionbot IRC bot 0.4-dev - Lovingly crafted by The DepressionBot Foundation (a charity arm of the Official Aberystwyth Open Source International Development League)."
|
"version": "Depressionbot IRC bot 0.4-dev - Lovingly crafted by The DepressionBot Foundation (a charity arm of the Official Aberystwyth Open Source International Development League)."
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
var _ = require('underscore')._;
|
var _ = require('underscore')._,
|
||||||
|
request = require('request');
|
||||||
|
|
||||||
var commands = function(dbot) {
|
var commands = function(dbot) {
|
||||||
return {
|
return {
|
||||||
@ -18,40 +19,26 @@ var commands = function(dbot) {
|
|||||||
|
|
||||||
'~help': function(event) {
|
'~help': function(event) {
|
||||||
var moduleName = event.params[1];
|
var moduleName = event.params[1];
|
||||||
if(!moduleName) {
|
if(!moduleName || !_.has(dbot.modules, moduleName)) {
|
||||||
helpfulModules = _.filter(dbot.modules, function(element, index, array) {
|
|
||||||
return _.has(dbot.config[element], 'help');
|
|
||||||
});
|
|
||||||
|
|
||||||
event.reply(dbot.t('usage', {
|
event.reply(dbot.t('usage', {
|
||||||
'command': '~help',
|
'command': '~help',
|
||||||
'usage': '~help [module]'
|
'usage': '~help [module]'
|
||||||
}));
|
}));
|
||||||
event.reply(dbot.t('loaded_modules_with_help', {
|
event.reply(dbot.t('loaded_modules', {
|
||||||
'modules': helpfulModules.join(', ')
|
'modules': _.keys(dbot.modules).join(', ')
|
||||||
}));
|
}));
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!_.has(dbot.modules, moduleName)) {
|
|
||||||
if(_.has(dbot.commands, moduleName)) {
|
|
||||||
var moduleName = dbot.commands[moduleName].module;
|
|
||||||
} else {
|
} else {
|
||||||
var moduleName = undefined;
|
var helpLink = dbot.config.repoRoot +
|
||||||
}
|
'blob/master/modules/' + moduleName + '/README.md';
|
||||||
|
if(dbot.config[moduleName].help) {
|
||||||
|
helpLink = dbot.config[moduleName].help;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(moduleName && _.has(dbot.config[moduleName], 'help')) {
|
// TODO: Check it exists
|
||||||
var help = dbot.config[moduleName].help;
|
|
||||||
event.reply(dbot.t('help_link', {
|
event.reply(dbot.t('help_link', {
|
||||||
'module': moduleName,
|
'module': moduleName,
|
||||||
'link': help
|
'link': helpLink
|
||||||
}));
|
}));
|
||||||
} else {
|
|
||||||
if(!moduleName) {
|
|
||||||
moduleName = event.params[1];
|
|
||||||
}
|
|
||||||
event.reply(dbot.t('no_help', { 'module': moduleName }))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
"na'vi": "Fì{module}ìri oel ke tsun run srungit",
|
"na'vi": "Fì{module}ìri oel ke tsun run srungit",
|
||||||
"nl": "Geen hulp gevonden voor {module}."
|
"nl": "Geen hulp gevonden voor {module}."
|
||||||
},
|
},
|
||||||
"loaded_modules_with_help": {
|
"loaded_modules": {
|
||||||
"en": "Loaded modules with help information: {modules}.",
|
"en": "Loaded modules: {modules}.",
|
||||||
"nl": "Geladen modules die hulpinformatie bevatten: {modules}."
|
"nl": "Geladen modules: {modules}."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user