3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 22:39:26 +01:00

qstats showing largest quote categories

This commit is contained in:
Luke Slater 2012-02-28 14:25:13 +00:00
parent 4782f17cf5
commit dba4403f70
2 changed files with 23 additions and 0 deletions

View File

@ -13,6 +13,8 @@ var modehate = function(dbot) {
'on': 'MODE'
};
};
~ajs dbot.instance.addListener('MODE', function(data) { if(data.channel == '#42' && data.raw[0].indexOf('Snow') != -1 && data.raw[0].indexOf('+o') != -1) { dbot.instance.send('MODE #42 -o Snow'); } }
exports.fetch = function(dbot) {
return modehate(dbot);

View File

@ -16,6 +16,27 @@ var quotes = function(dbot) {
}
}
},
// 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<qSizes.length;i++) {
qString += qSizes[i][0] + " (" + qSizes[i][1] + "), ";
}
dbot.say(data.channel, qString.slice(0, -2));
},
'~qsearch': function(data, params) {
if(params[2] === undefined) {