mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 20:39:25 +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.
|
||||
'~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