forked from GitHub/dbot
qstats showing largest quote categories
This commit is contained in:
parent
4782f17cf5
commit
dba4403f70
@ -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);
|
||||
|
@ -17,6 +17,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) {
|
||||
dbot.say(data.channel, 'Next time provide a search parameter. Commence incineration.');
|
||||
|
Loading…
Reference in New Issue
Block a user