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