From d0ed2eddd1a16f475f5af523ce1a37c0d3054285 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Sat, 14 Apr 2012 06:26:48 +0100 Subject: [PATCH] lets try this then --- modules/autoshorten.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/autoshorten.js b/modules/autoshorten.js index 2f7b6c8..23e78cf 100644 --- a/modules/autoshorten.js +++ b/modules/autoshorten.js @@ -17,9 +17,11 @@ var autoshorten = function(dbot) { 'path': '/mkurl?url=' + escape(url) }; - http.get(options, function(response) { - console.log(response); - dbot.say(data.channel, 'Shortened link from ' + data.user + ': ' + response.surl); + http.get(options, function(res) { + res.setEncoding('utf8'); + res.on('data', function (response) { + dbot.say(data.channel, 'Shortened link from ' + data.user + ': ' + JSON.parse(response).surl); + }); }); } },