From 0db0abeb6a4c48e72228eaaf5dc4800fd788601d Mon Sep 17 00:00:00 2001 From: reality Date: Thu, 17 Oct 2013 11:50:34 +0000 Subject: [PATCH] shoutiest and wordiest --- modules/sstats/commands.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/modules/sstats/commands.js b/modules/sstats/commands.js index e52720d..9438d76 100644 --- a/modules/sstats/commands.js +++ b/modules/sstats/commands.js @@ -100,6 +100,30 @@ var commands = function(dbot) { }.bind(this)); }, + '~shoutiest': function(event) { + this.internalAPI.highscore('user_stats', 'capitals', function(lCounts) { + async.eachSeries(lCounts, function(lCount, next) { + dbot.api.users.getUser(lCount[0], function(user) { + lCount[0] = user.primaryNick; next(); + }); + }, function() { + event.reply(this.internalAPI.formatHighscore('Shoutiest users: ', lCounts)); + }.bind(this)); + }.bind(this)); + }, + + '~wordiest': function(event) { + this.internalAPI.highscore('user_stats', 'words', function(lCounts) { + async.eachSeries(lCounts, function(lCount, next) { + dbot.api.users.getUser(lCount[0], function(user) { + lCount[0] = user.primaryNick; next(); + }); + }, function() { + event.reply(this.internalAPI.formatHighscore('Wordiest users: ', lCounts)); + }.bind(this)); + }.bind(this)); + }, + '~cloudest': function(event) { var pathString = 'channels.' + event.rChannel.id + '.lines'; this.internalAPI.highscore('user_stats', pathString, function(lCounts) {