Fix URL matching in automod, censor, and spam plugin

This commit is contained in:
Dragory 2019-11-27 20:41:45 +02:00
parent 682d8e9153
commit 9164bcd045
3 changed files with 23 additions and 1 deletions

View file

@ -189,7 +189,7 @@ const urlRegex = /(\S+\.\S+)/g;
const protocolRegex = /^[a-z]+:\/\//;
export function getUrlsInString(str: string, unique = false): url.URL[] {
let matches = (str.match(urlRegex) || []).map(m => m[0]);
let matches = str.match(urlRegex) || [];
if (unique) matches = Array.from(new Set(matches));
return matches.reduce((urls, match) => {