3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 03:33:07 +01:00

lower-case all quote keys

This commit is contained in:
Luke Slater 2011-08-24 16:15:56 +01:00
parent 3a36ee1894
commit d17ee73393

View File

@ -3,6 +3,7 @@ var quotes = function(dbot) {
return {
get: function(key) {
key = key.toLowerCase();
if(quotes.hasOwnProperty(key)) {
return key + ': ' + quotes[key].random();
} else {
@ -11,6 +12,7 @@ var quotes = function(dbot) {
},
count: function(key) {
key = key.toLowerCase();
if(quotes.hasOwnProperty(key)) {
return key + ' has ' + quotes[key].length + ' quotes.';
} else {
@ -19,6 +21,7 @@ var quotes = function(dbot) {
},
add: function(key) {
key[1] = key[1].toLowerCase();
if(!Object.isArray(quotes[key[1]])) {
quotes[key[1]] = [];
}
@ -27,6 +30,7 @@ var quotes = function(dbot) {
},
set: function(key) {
key[1] = key[1].toLowerCase();
if(!quotes.hasOwnProperty(key[1]) || (quotes.hasOwnProperty(key[1]) && quotes[key[1]].length == 1)) {
quotes[key[1]] = [key[2]];
return 'Quote saved as ' + key[1];