forked from GitHub/dbot
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.
|
||||
'~q': function(event) {
|
||||
var key = event.input[1].trim().toLowerCase();
|
||||
var altKey;
|
||||
if(key.split(' ').length > 0) {
|
||||
altKey = key.replace(/ /g, '_');
|
||||
}
|
||||
|
||||
if(quotes.hasOwnProperty(key)) {
|
||||
event.reply(key + ': ' + interpolatedQuote(key));
|
||||
} else if(quotes.hasOwnProperty(altKey)) {
|
||||
event.reply(key + ': ' + interpolatedQuote(altKey));
|
||||
} else {
|
||||
event.reply(dbot.t('category_not_found', {'category': key}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user