diff --git a/src/structure/components/observers/Automoderation.js b/src/structure/components/observers/Automoderation.js index 2376a89..19b8c52 100644 --- a/src/structure/components/observers/Automoderation.js +++ b/src/structure/components/observers/Automoderation.js @@ -441,7 +441,12 @@ module.exports = class AutoModeration extends Observer { if (!msg.content) return; const content = msg.content.split('').join(''); //Copy the string... let matches = content.match(this.regex.linkRegG); - if (!matches) matches = content.replace(/\s/u, '').match(this.regex.linkRegG); + let removedWhitespace = false; + if (!matches) { + matches = content.replace(/\s/u, '').match(this.regex.linkRegG); + removedWhitespace = true; + } + if (!matches) return; let remove = false; const filterResult = {}; @@ -480,6 +485,9 @@ module.exports = class AutoModeration extends Observer { // console.log(parts, validTld); if (!validTld) continue; const valid = await resolver.validateDomain(domain); + + if (removedWhitespace && !match.includes(`${domain}/`)) continue; + if (!valid) { if (match.includes(`${domain}/`)) this.client.emit('linkFilterWarn', { guild: wrapper, message: wrapper.format('LINKFILTER_WARN', { domain, link: match }) }); continue;