/** * Module Name: sstats * Description: Simple Stats, in the absence of good ones. */ var _ = require('underscore')._, async = require('async'); var sstats = function(dbot) { if(!_.has(dbot.db, 'ssinception')) dbot.db.ssinception = new Date().getTime(); // This needs to be somewhere else this.isUpperCase = function(word) { return _.all(word.split(''), function(c) { return c == c.toUpperCase(); }); }; this.internalAPI = { // I'm not a huge fan of this but it's better than all the code // repetition 'highscore': function(key, property, callback) { var pList = {}, pPointer = property; if(!_.isArray(pPointer)) { pPointer = property.split('.'); } this.db.scan(key, function(item) { var id = item.id; for(var i=0;i