linkfilter debugging
This commit is contained in:
parent
5904f4cd47
commit
5065b85952
@ -515,9 +515,11 @@ module.exports = class AutoModeration extends Observer {
|
||||
if (!matches) return;
|
||||
let remove = false;
|
||||
const filterResult = {};
|
||||
let log = 'Link filter debug:';
|
||||
|
||||
for (const match of matches) {
|
||||
const { domain } = match.match(linkReg).groups;
|
||||
log += `\nMatched link ${match}: `;
|
||||
|
||||
const predicate = (dom) => {
|
||||
return dom.includes(domain) || domain.includes(dom);
|
||||
@ -534,7 +536,10 @@ module.exports = class AutoModeration extends Observer {
|
||||
remove = true;
|
||||
break;
|
||||
} else if (whitelistMode) {
|
||||
if (whitelist.some(predicate)) continue;
|
||||
if (whitelist.some(predicate)) {
|
||||
log += 'in whitelist';
|
||||
continue;
|
||||
}
|
||||
const valid = await resolver.validateDomain(domain);
|
||||
if (!valid) {
|
||||
this.client.emit('linkFilterWarn', { message: guild.format('LINKFILTER_WARN', { domain }) });
|
||||
@ -549,6 +554,9 @@ module.exports = class AutoModeration extends Observer {
|
||||
|
||||
}
|
||||
|
||||
log += `\nFilter result: ${inspect(filterResult)}\nRemove: ${remove}`;
|
||||
this.logger.debug(log);
|
||||
|
||||
if (!remove) return;
|
||||
msg.filtered = filterResult;
|
||||
filterResult.filter = 'link';
|
||||
|
Loading…
Reference in New Issue
Block a user