const bot = require('bbot'); const request = require('request'); bot.global.text(/(https?:\/\/[^ ,\)"]*)/ig, (b) => { // console.log(JSON.stringify(b.envelope.payload, null, 2)); for (url of b.match) { // console.log(JSON.stringify(url, null, 2)); if (!/(coa|pad)\.crapaud-fou\.org/.test(url)) { request(url, (err, res, body) => { if (!err) { var re = /]*>([^<]*)<\/title>/gi; var match = re.exec(body); if (match && match[1]) { // b.respondEnvelope({ attachments: [] }) // b.envelope.payload.quickReply({ attachments: [] }); b.respond("[:link:](" + url + ") _" + match[1] + "_"); } } }); } } }, { id: 'get-url-metadata' });