From 7b515a4cc5ad051a7211a460eb6d269b7bb7ec2b Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Tue, 11 Dec 2012 16:02:06 +0000 Subject: [PATCH] remove autoshorten because the shortener does not exist anymore --- modules/autoshorten.js | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 modules/autoshorten.js diff --git a/modules/autoshorten.js b/modules/autoshorten.js deleted file mode 100644 index 7199ec8..0000000 --- a/modules/autoshorten.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Module Name: AutoShorten - * Description: Automatically shorten link over a certain length and post the - * short link to the channel. - */ -var http = require('http'); - -var autoshorten = function(dbot) { - return { - 'name': 'autoshorten', - 'ignorable': true, - - 'listener': function(event) { - var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; - var urlMatches = event.message.match(urlRegex); - - if(urlMatches !== null && urlMatches[0].length > 80) { - var url = urlMatches[0]; // Only doing one, screw you. - - // TODO: Make this use a decent URL shortener. Mine is shit. - var options = { - 'host': dbot.webHost, - 'port': dbot.webPort, - 'path': '/mkurl?url=' + escape(url) - }; - - http.get(options, function(res) { - res.setEncoding('utf8'); - res.on('data', function (response) { - event.reply(dbot.t('shorten_link', {'user': event.user}) + JSON.parse(response).surl); - }); - }); - } - }, - 'on': 'PRIVMSG' - }; -} - -exports.fetch = function(dbot) { - return autoshorten(dbot); -};