put reactions before url_metadata to inhibit facebook links discovery

This commit is contained in:
mose 2019-09-15 08:30:30 +08:00
parent 03e20fced0
commit f0bd2e365a
2 changed files with 3 additions and 3 deletions

View file

@ -9,7 +9,7 @@ server.listen(process.env.PORT || 5000)
/** Add your bot logic here. Removing the imported examples. */ /** Add your bot logic here. Removing the imported examples. */
// require('./src/examples') // require('./src/examples')
require('./src/url_metadata')
require('./src/reactions') require('./src/reactions')
require('./src/url_metadata')
bot.start() // 🚀 bot.start() // 🚀

View file

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