better url mathcing for title
This commit is contained in:
parent
156282f571
commit
7a2c6f607d
1 changed files with 2 additions and 2 deletions
|
@ -3,10 +3,10 @@ const bot = require('bbot');
|
|||
const request = require('request');
|
||||
|
||||
bot.global.text(/(https?:\/\/.*)[, $]?/i, (b) => {
|
||||
if (!b.match[1].match(/coa\.crapaud-fou\.org/)) {
|
||||
if (!/coa\.crapaud-fou\.org/.test(b.match[1])) {
|
||||
request(b.match[1], (err, res, body) => {
|
||||
if (!err) {
|
||||
var re = /<title>([^<]*)<\/title>/gi;
|
||||
var re = /<title[^>]*>([^<]*)<\/title>/gi;
|
||||
var match = re.exec(body);
|
||||
if (match && match[1]) {
|
||||
b.respond("[:link:](" + b.match[1] + ") _" + match[1] + "_");
|
||||
|
|
Loading…
Reference in a new issue