diff --git a/structure/client/components/observers/Automoderation.js b/structure/client/components/observers/Automoderation.js index eab3d5e..eff8abc 100644 --- a/structure/client/components/observers/Automoderation.js +++ b/structure/client/components/observers/Automoderation.js @@ -97,6 +97,7 @@ module.exports = class AutoModeration extends Observer { // Which message obj to work with const msg = edited || message; + if (!msg.content) return; let log = `Message filter debug:`; log += `\nPre norm: ${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 msg = edited || message; + if (!msg.content) return; const content = FilterUtil.normalise(msg.cleanContent); 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; const msg = edited || message; + if (!msg.content) return; const content = msg.content.split('').join(''); //Copy the string... const linkRegG = /(https?:\/\/(www\.)?)?(?([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\.)?)?(?([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 { content } = msg; + if (!content) return; const reg = /((discord)?\s?\.?\s?gg\s?|discord(app)?\.com\/invite)\/\s?(?[a-z0-9]+)/iu; const match = content.match(reg); @@ -465,6 +469,7 @@ module.exports = class AutoModeration extends Observer { const reg = /<@!?[0-9]{18,22}>/gu; const { content } = message; + if (!content) return; //const mentions = content.match(reg); }