forked from GitHub/dbot
~kickstats
This commit is contained in:
parent
33fc7712a8
commit
c453c80536
@ -22,8 +22,8 @@ var quotes = function(dbot) {
|
|||||||
if(q) {
|
if(q) {
|
||||||
if(quotes.hasOwnProperty(q[1])) {
|
if(quotes.hasOwnProperty(q[1])) {
|
||||||
var quote = quotes[q[1]].pop();
|
var quote = quotes[q[1]].pop();
|
||||||
dbot.say(data.channel, '\'' + quote + '\' removed from ' + q[1]);
|
|
||||||
rmAllowed = false;
|
rmAllowed = false;
|
||||||
|
dbot.say(data.channel, '\'' + quote + '\' removed from ' + q[1]);
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No quotes exist under ' + q[1]);
|
dbot.say(data.channel, 'No quotes exist under ' + q[1]);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,26 @@ var userCommands = function(dbot) {
|
|||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, params[1] + ' has been kicked ' + dbot.db.kicks[params[1]] + ' times.');
|
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