From af829ff62a1b891a7e9e96917818eea514c28cd0 Mon Sep 17 00:00:00 2001 From: toast-ts <96593068+toast-ts@users.noreply.github.com> Date: Mon, 1 Apr 2024 18:43:02 +1100 Subject: [PATCH] Fix one thing, break another. --- src/components/Automod.ts | 2 +- src/events/messageCreate.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/Automod.ts b/src/components/Automod.ts index adde8d1..45b5077 100644 --- a/src/components/Automod.ts +++ b/src/components/Automod.ts @@ -4,7 +4,7 @@ import Logger from '../helpers/Logger.js'; export default class Automoderator { private static logPrefix:string = 'Automod'; private static lockQuery:Set = new Set(); - static scanMsg =(message:Discord.Message)=>message.content.toLowerCase().replaceAll(/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?\n?0-9]|[]|ing\b|ed\b|es\b/g, '').split(' ').join(''); + static scanMsg =(message:Discord.Message)=>message.content.toLowerCase().replaceAll(/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?\n?0-9]|ing\b|ed\b|es\b|er\b|$/g, '').split(' ').join(''); static async repeatedMessages(client:TClient, message:Discord.Message, action:'mute'|'ban'|'softban', thresholdTime:number, thresholdAmount:number, type:string, duration:string, reason:string) { const now = Date.now(); diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index 106d53a..d15b968 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -64,9 +64,13 @@ export default class MessageCreate { ]; for (const rule of automodRules) { - if (!automodded && rule.name && await rule.check()) { - await rule.action(); - break; + try { + if (!automodded && rule.name) { + const result = await rule.check(); + if (result) await rule.action(); + } + } catch(y) { + Logger.console('error', 'Automod', y); } } };