avoid url_metadata to react to chat internal links
This commit is contained in:
parent
7d01477469
commit
156282f571
1 changed files with 10 additions and 8 deletions
|
@ -3,15 +3,17 @@ const bot = require('bbot');
|
||||||
const request = require('request');
|
const request = require('request');
|
||||||
|
|
||||||
bot.global.text(/(https?:\/\/.*)[, $]?/i, (b) => {
|
bot.global.text(/(https?:\/\/.*)[, $]?/i, (b) => {
|
||||||
request(b.match[1], (err, res, body) => {
|
if (!b.match[1].match(/coa\.crapaud-fou\.org/)) {
|
||||||
if (!err) {
|
request(b.match[1], (err, res, body) => {
|
||||||
var re = /<title>([^<]*)<\/title>/gi;
|
if (!err) {
|
||||||
var match = re.exec(body);
|
var re = /<title>([^<]*)<\/title>/gi;
|
||||||
if (match && match[1]) {
|
var match = re.exec(body);
|
||||||
b.respond("[:link:](" + b.match[1] + ") _" + match[1] + "_");
|
if (match && match[1]) {
|
||||||
|
b.respond("[:link:](" + b.match[1] + ") _" + match[1] + "_");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}, {
|
}, {
|
||||||
id: 'get-url-metadata'
|
id: 'get-url-metadata'
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue