mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 22:39:26 +01:00
Automatically replace spaces in quotes with underscores, then use that quote if the originally given quote can't be found
This commit is contained in:
parent
333e3c592d
commit
b9b5d9913d
@ -41,8 +41,15 @@ var quotes = function(dbot) {
|
|||||||
// Retrieve quote from a category in the database.
|
// Retrieve quote from a category in the database.
|
||||||
'~q': function(event) {
|
'~q': function(event) {
|
||||||
var key = event.input[1].trim().toLowerCase();
|
var key = event.input[1].trim().toLowerCase();
|
||||||
|
var altKey;
|
||||||
|
if(key.split(' ').length > 0) {
|
||||||
|
altKey = key.replace(/ /g, '_');
|
||||||
|
}
|
||||||
|
|
||||||
if(quotes.hasOwnProperty(key)) {
|
if(quotes.hasOwnProperty(key)) {
|
||||||
event.reply(key + ': ' + interpolatedQuote(key));
|
event.reply(key + ': ' + interpolatedQuote(key));
|
||||||
|
} else if(quotes.hasOwnProperty(altKey)) {
|
||||||
|
event.reply(key + ': ' + interpolatedQuote(altKey));
|
||||||
} else {
|
} else {
|
||||||
event.reply(dbot.t('category_not_found', {'category': key}));
|
event.reply(dbot.t('category_not_found', {'category': key}));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user