This commit is contained in:
Erik 2021-06-06 19:08:51 +03:00
parent 44251ed305
commit ba952afa46
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16

View File

@ -97,6 +97,7 @@ module.exports = class AutoModeration extends Observer {
// Which message obj to work with // Which message obj to work with
const msg = edited || message; const msg = edited || message;
if (!msg.content) return;
let log = `Message filter debug:`; let log = `Message filter debug:`;
log += `\nPre norm: ${msg.cleanContent}`; log += `\nPre norm: ${msg.cleanContent}`;
const content = FilterUtil.normalise(FilterUtil.removeDiscordFormatting(msg.cleanContent)); const content = FilterUtil.normalise(FilterUtil.removeDiscordFormatting(msg.cleanContent));
@ -286,6 +287,7 @@ module.exports = class AutoModeration extends Observer {
const logChannel = await guild.resolveChannel(_logChannel); const logChannel = await guild.resolveChannel(_logChannel);
const msg = edited || message; const msg = edited || message;
if (!msg.content) return;
const content = FilterUtil.normalise(msg.cleanContent); const content = FilterUtil.normalise(msg.cleanContent);
let match = null; let match = null;
@ -340,6 +342,7 @@ module.exports = class AutoModeration extends Observer {
if (roles.some((r) => bypass.includes(r.id)) || ignore.includes(channel.id)) return; if (roles.some((r) => bypass.includes(r.id)) || ignore.includes(channel.id)) return;
const msg = edited || message; const msg = edited || message;
if (!msg.content) return;
const content = msg.content.split('').join(''); //Copy the string... const content = msg.content.split('').join(''); //Copy the string...
const linkRegG = /(https?:\/\/(www\.)?)?(?<domain>([a-z0-9-]{1,63}\.)?([a-z0-9-]{2,63})(\.[a-z0-9-]{2,63})(\.[a-z0-9-]{2,63})?)(\/\S*)?/iug; const linkRegG = /(https?:\/\/(www\.)?)?(?<domain>([a-z0-9-]{1,63}\.)?([a-z0-9-]{2,63})(\.[a-z0-9-]{2,63})(\.[a-z0-9-]{2,63})?)(\/\S*)?/iug;
const linkReg = /(https?:\/\/(www\.)?)?(?<domain>([a-z0-9-]{1,63}\.)?([a-z0-9-]{2,63})(\.[a-z0-9-]{2,63})(\.[a-z0-9-]{2,63})?)(\/\S*)?/iu; const linkReg = /(https?:\/\/(www\.)?)?(?<domain>([a-z0-9-]{1,63}\.)?([a-z0-9-]{2,63})(\.[a-z0-9-]{2,63})(\.[a-z0-9-]{2,63})?)(\/\S*)?/iu;
@ -421,6 +424,7 @@ module.exports = class AutoModeration extends Observer {
const msg = edited || message; const msg = edited || message;
const { content } = msg; const { content } = msg;
if (!content) return;
const reg = /((discord)?\s?\.?\s?gg\s?|discord(app)?\.com\/invite)\/\s?(?<code>[a-z0-9]+)/iu; const reg = /((discord)?\s?\.?\s?gg\s?|discord(app)?\.com\/invite)\/\s?(?<code>[a-z0-9]+)/iu;
const match = content.match(reg); const match = content.match(reg);
@ -465,6 +469,7 @@ module.exports = class AutoModeration extends Observer {
const reg = /<@!?[0-9]{18,22}>/gu; const reg = /<@!?[0-9]{18,22}>/gu;
const { content } = message; const { content } = message;
if (!content) return;
//const mentions = content.match(reg); //const mentions = content.match(reg);
} }