diff --git a/modules/link/README.md b/modules/link/README.md index fed0a33..d8b85cd 100644 --- a/modules/link/README.md +++ b/modules/link/README.md @@ -23,3 +23,6 @@ which was posted in the current channel. Returns the first [Urban Dictionary](http://www.urbandictionary.com) definition for the headword provided. #### ~xkcd Returns a link to the [xkcd](http://xkcd.com) comic specified, or the latest one if a comic is not given. Use '*' to return a link to a random comic. + +### Requirements +* [node-ent](https://github.com/substack/node-ent) diff --git a/modules/link/link.js b/modules/link/link.js index be97299..2d9c994 100644 --- a/modules/link/link.js +++ b/modules/link/link.js @@ -4,7 +4,8 @@ * information about links. */ var request = require('request'), - _ = require('underscore')._; + _ = require('underscore')._, + ent = require('ent'); var link = function(dbot) { this.urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; @@ -15,7 +16,7 @@ var link = function(dbot) { body = body.replace(/(\r\n|\n\r|\n)/gm, " "); var title = body.valMatch(/(.*)<\/title>/, 2); if(title && title.length < 140) { - event.reply(title[1]); + event.reply(ent.decode(title[1])); } } });