3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +01:00

filesize in imgur

This commit is contained in:
reality 2015-07-19 21:34:09 +00:00
parent cf509cb3c5
commit bfa4de5a1a
3 changed files with 5 additions and 3 deletions

View File

@ -14,7 +14,7 @@ then
exit 1 exit 1
fi fi
npm install googlemaps feedparser node-units tvdb method-override 500px process async wordnik node-uuid underscore request sandbox express moment-timezone moment jade databank databank-redis ent passport passport-local password-hash connect-flash npm install googlemaps humanize feedparser node-units tvdb method-override 500px process async wordnik node-uuid underscore request sandbox express moment-timezone moment jade databank databank-redis ent passport passport-local password-hash connect-flash
cd public/ cd public/
wget https://github.com/twbs/bootstrap/releases/download/v3.3.2/bootstrap-3.3.2-dist.zip wget https://github.com/twbs/bootstrap/releases/download/v3.3.2/bootstrap-3.3.2-dist.zip

View File

@ -6,7 +6,8 @@
var _ = require('underscore')._, var _ = require('underscore')._,
request = require('request'), request = require('request'),
async = require('async'), async = require('async'),
crypto = require('crypto'); crypto = require('crypto'),
humanise = require('humanize');
var imgur = function(dbot) { var imgur = function(dbot) {
this.ApiRoot = 'https://api.imgur.com/3/'; this.ApiRoot = 'https://api.imgur.com/3/';
@ -42,6 +43,8 @@ var imgur = function(dbot) {
} }
info += imgData.views + ' views ('; info += imgData.views + ' views (';
info += imgData.width + 'x' + imgData.height + ')'; info += imgData.width + 'x' + imgData.height + ')';
info += ' ('+humanise.filesize(imgData.size)+')';
} }
return info; return info;

View File

@ -140,7 +140,6 @@ var users = function(dbot) {
}.bind(this); }.bind(this);
var checkUserTime = function(user, done) { var checkUserTime = function(user, done) {
if(!_.has(user, 'lastUsed') || (_.has(user, 'lastUsed') && moment(user.lastUsed).diff(moment(user.lastUsed).add(1, 'day'), 'days') > 0)) { if(!_.has(user, 'lastUsed') || (_.has(user, 'lastUsed') && moment(user.lastUsed).diff(moment(user.lastUsed).add(1, 'day'), 'days') > 0)) {
dbot.api.log.log('tripsit', 'tripbot', '[USERDEBUG] Updating last used date for ' + user.primaryNick);
user.lastUsed = moment().unix(); user.lastUsed = moment().unix();
this.db.save('users', user.id, user, done); this.db.save('users', user.id, user, done);
} else { } else {