mirror of
https://github.com/reality/dbot.git
synced 2024-12-25 20:22:39 +01:00
Merge pull request #319 from JohnMaguire2013/quotes
fixing some minor bugs in quotes module
This commit is contained in:
commit
7fdf145e26
@ -110,7 +110,7 @@ var commands = function(dbot) {
|
|||||||
'category': key
|
'category': key
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
event.reply(dbot.t('no_quotes', {'category': q[1]}));
|
event.reply(dbot.t('no_quotes', {'category': key}));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.reply(dbot.t('rmlast_spam'));
|
event.reply(dbot.t('rmlast_spam'));
|
||||||
@ -187,13 +187,19 @@ var commands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
'~rq': function(event) {
|
'~rq': function(event) {
|
||||||
|
if(_.keys(quotes).length > 0) {
|
||||||
var category = _.keys(quotes)[_.random(0, _.size(quotes) -1)];
|
var category = _.keys(quotes)[_.random(0, _.size(quotes) -1)];
|
||||||
event.reply(category + ': ' + this.internalAPI.interpolatedQuote(event.server, event.channel.name, category));
|
event.reply(category + ': ' + this.internalAPI.interpolatedQuote(event.server, event.channel.name, category));
|
||||||
|
} else {
|
||||||
|
event.reply(dbot.t('no_results'));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
'~link': function(event) {
|
'~link': function(event) {
|
||||||
var key = event.input[1].toLowerCase();
|
var key = event.input[1].toLowerCase();
|
||||||
if(_.has(quotes, key)) {
|
if(_.has(quotes, key)) {
|
||||||
|
if(_.has(dbot.config, 'web') && _.has(dbot.config.web, 'webHost') &&
|
||||||
|
_.has(dbot.config.web, 'webPort')) {
|
||||||
event.reply(dbot.t('quote_link', {
|
event.reply(dbot.t('quote_link', {
|
||||||
'category': key,
|
'category': key,
|
||||||
'url': dbot.t('url', {
|
'url': dbot.t('url', {
|
||||||
@ -202,6 +208,9 @@ var commands = function(dbot) {
|
|||||||
'path': 'quotes/' + encodeURIComponent(key)
|
'path': 'quotes/' + encodeURIComponent(key)
|
||||||
})
|
})
|
||||||
}));
|
}));
|
||||||
|
} else {
|
||||||
|
event.reply(dbot.t('web_not_configured'));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
event.reply(dbot.t('category_not_found', { 'category': key }));
|
event.reply(dbot.t('category_not_found', { 'category': key }));
|
||||||
}
|
}
|
||||||
@ -213,7 +222,7 @@ var commands = function(dbot) {
|
|||||||
commands['~qsearch'].regex = [/^~qsearch ([\d\w\s-]+?)[ ]?=[ ]?(.+)$/, 3];
|
commands['~qsearch'].regex = [/^~qsearch ([\d\w\s-]+?)[ ]?=[ ]?(.+)$/, 3];
|
||||||
commands['~rm'].regex = [/^~rm ([\d\w\s-]+?)[ ]?=[ ]?(.+)$/, 3];
|
commands['~rm'].regex = [/^~rm ([\d\w\s-]+?)[ ]?=[ ]?(.+)$/, 3];
|
||||||
commands['~rmlast'].regex = [/^~rmlast ([\d\w\s-]*)/, 2];
|
commands['~rmlast'].regex = [/^~rmlast ([\d\w\s-]*)/, 2];
|
||||||
commands['~qadd'].regex = [/^~qadd ([\d\w\s-]+?)[ ]?=[ ]?(.+)$/, 3];
|
commands['~qadd'].regex = [/^~qadd ([\d\w-]+[\d\w\s-]*)[ ]?=[ ]?(.+)$/, 3];
|
||||||
commands['~link'].regex = [/^~link ([\d\w\s-]*)/, 2];
|
commands['~link'].regex = [/^~link ([\d\w\s-]*)/, 2];
|
||||||
|
|
||||||
commands['~rmconfirm'].access = 'moderator';
|
commands['~rmconfirm'].access = 'moderator';
|
||||||
|
@ -126,5 +126,8 @@
|
|||||||
"rm_cache_limit": {
|
"rm_cache_limit": {
|
||||||
"en": "Attention: Too many quotes removed, rmCache must be cleared or reinstated manually with ~rmconfirm or ~rmdeny.",
|
"en": "Attention: Too many quotes removed, rmCache must be cleared or reinstated manually with ~rmconfirm or ~rmdeny.",
|
||||||
"na'vi": "Oel zerok 'upxareti apxay set, sweylu txo nga 'aivku upxareti ìlä ~rmconfirm fu ~rmdeny."
|
"na'vi": "Oel zerok 'upxareti apxay set, sweylu txo nga 'aivku upxareti ìlä ~rmconfirm fu ~rmdeny."
|
||||||
|
},
|
||||||
|
"web_not_configured": {
|
||||||
|
"en": "Cannot link to category. Web module is either not loaded or misconfigured."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user