mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
~kickstats
This commit is contained in:
parent
33fc7712a8
commit
c453c80536
@ -22,8 +22,8 @@ var quotes = function(dbot) {
|
||||
if(q) {
|
||||
if(quotes.hasOwnProperty(q[1])) {
|
||||
var quote = quotes[q[1]].pop();
|
||||
dbot.say(data.channel, '\'' + quote + '\' removed from ' + q[1]);
|
||||
rmAllowed = false;
|
||||
dbot.say(data.channel, '\'' + quote + '\' removed from ' + q[1]);
|
||||
} else {
|
||||
dbot.say(data.channel, 'No quotes exist under ' + q[1]);
|
||||
}
|
||||
|
@ -13,6 +13,26 @@ var userCommands = function(dbot) {
|
||||
} else {
|
||||
dbot.say(data.channel, params[1] + ' has been kicked ' + dbot.db.kicks[params[1]] + ' times.');
|
||||
}
|
||||
},
|
||||
|
||||
'~kickstats': function(data, params) {
|
||||
var kickArr = [];
|
||||
for(var kickUser in dbot.db.kicks) {
|
||||
if(dbot.db.kicks.hasOwnProperty(kickUser)) {
|
||||
kickArr.push([kickUser, dbot.db.kicks[kickUser]]);
|
||||
}
|
||||
}
|
||||
|
||||
var orderedKicks = kickArr.sort(function(a, b) { return a[1] - b[1]; });
|
||||
var topKicks = kickArr.slice(kickArr.length - 5).reverse();
|
||||
var kickString = "Top Kicks: ";
|
||||
|
||||
for(var i=0;i<topKicks.length;i++) {
|
||||
kickString += topKicks[i][0] + " (" + topKicks[i][1] + "), ";
|
||||
}
|
||||
kickString = kickString.slice(0, -2);
|
||||
|
||||
dbot.say(data.channel, kickString);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user