var quotes = function(dbot) { var quotes = dbot.db.quoteArrs; var addStack = []; var rmAllowed = true; var commands = { '~q': function(data, params) { var q = data.message.valMatch(/^~q ([\d\w\s-]*)/, 2); if(q) { q[1] = q[1].trim(); key = q[1].toLowerCase(); if(quotes.hasOwnProperty(key)) { dbot.say(data.channel, q[1] + ': ' + quotes[key].random()); } else { dbot.say(data.channel, 'Nobody loves ' + q[1]); } } }, // shows the biggest categories '~qstats': function(data, params) { var qSizes = []; for(var cat in quotes) { if(quotes[cat].length != 0) { qSizes.push([cat, quotes[cat].length]); } } qSizes = qSizes.sort(function(a, b) { return a[1] - b[1]; }); qSizes = qSizes.slice(kickArr.length - 10).reverse(); var qString = "Largest categories: "; for(var i=0;i