diff --git a/modules/report/commands.js b/modules/report/commands.js index b1b32f7..4234c6f 100644 --- a/modules/report/commands.js +++ b/modules/report/commands.js @@ -2,6 +2,38 @@ var _ = require('underscore')._; var commands = function(dbot) { var commands = { + '~ncount': function(event) { + var chanCounts = {}, + total = 0; + + this.db.scan('notifies', function(notify) { + if(notify.user == event.rUser.id) { + if(!_.has(chanCounts, notify.channel)) chanCounts[notify.channel] = 0; + chanCounts[notify.channel]++; + total++; + } + }, function() { + var cCounts = _.chain(chanCounts) + .pairs() + .sortBy(function(p) { return p[1]; }) + .reverse() + .first(10) + .value(); + + var cString = ''; + for(var i=0;i