3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-24 04:49:25 +01:00

Only auto shorten long links

This commit is contained in:
Luke Slater 2012-04-14 06:37:17 +01:00
parent d0ed2eddd1
commit 19a3d9cf87

View File

@ -8,7 +8,7 @@ var autoshorten = function(dbot) {
var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
var urlMatches = data.message.match(urlRegex);
if(urlMatches !== null) {
if(urlMatches !== null && urlMatches[0].length > 45) {
var url = urlMatches[0]; // Only doing one, screw you.
var options = {