From 5eba864f2247e044ecf44d326f09bafa8ad28f50 Mon Sep 17 00:00:00 2001 From: reality Date: Mon, 22 Apr 2013 14:38:03 +0000 Subject: [PATCH] fix imgur for now --- modules/imgur/imgur.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/imgur/imgur.js b/modules/imgur/imgur.js index 507e6f2..3bea45a 100644 --- a/modules/imgur/imgur.js +++ b/modules/imgur/imgur.js @@ -7,7 +7,6 @@ var _ = require('underscore')._, request = require('request'); var imgur = function(dbot) { - this.db = dbot.db.imgur; this.internalAPI = { 'infoString': function(imgData) { info = ''; @@ -45,11 +44,11 @@ var imgur = function(dbot) { var testUrl = 'http://i.imgur.com/' + testSlug + '.' + ext[_.random(0, ext.length - 1)]; - this.db.totalHttpRequests += 1; + dbot.db.imgur.totalHttpRequests += 1; var image = request(testUrl, function(error, response, body) { // 492 is body.length of a removed image if(!error && response.statusCode == 200 && body.length != 492) { - this.db.totalImages += 1; + dbot.db.imgur.totalImages += 1; callback(testUrl, testSlug); } else { this.api.getRandomImage(callback); @@ -71,7 +70,7 @@ var imgur = function(dbot) { 'Authorization': 'Client-ID ' + dbot.config.imgur.apikey } }, function(err, response, body) { - this.db.totalApiRequests += 1; + dbot.db.imgur.totalApiRequests += 1; callback(body); }.bind(this)); }