3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-28 13:42:36 +01:00

Change initialisation of kickArr to Object.keys rather than manually filling it...

This commit is contained in:
Luke Slater 2012-06-24 23:28:07 +01:00
parent 253b9a75c4
commit 2b48d1a555

View File

@ -26,13 +26,7 @@ var kick = function(dbot) {
// who have kicked other people the most.
'~kickstats': function(event) {
var orderedKickLeague = function(list, topWhat) {
var kickArr = [];
for(var kickUser in list) {
if(list.hasOwnProperty(kickUser)) {
kickArr.push([kickUser, list[kickUser]]);
}
}
var kickArr = Object.keys(list);
kickArr = kickArr.sort(function(a, b) { return a[1] - b[1]; });
kickArr = kickArr.slice(kickArr.length - 10).reverse();
var kickString = "Top " + topWhat + ": ";