1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 20:30:58 -05:00

Fix one thing, break another.

This commit is contained in:
toast-ts 2024-04-01 18:43:02 +11:00
parent 4870331a15
commit af829ff62a
2 changed files with 8 additions and 4 deletions

View File

@ -4,7 +4,7 @@ import Logger from '../helpers/Logger.js';
export default class Automoderator { export default class Automoderator {
private static logPrefix:string = 'Automod'; private static logPrefix:string = 'Automod';
private static lockQuery:Set<Discord.Snowflake> = new Set(); private static lockQuery:Set<Discord.Snowflake> = 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) { 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(); const now = Date.now();

View File

@ -64,9 +64,13 @@ export default class MessageCreate {
]; ];
for (const rule of automodRules) { for (const rule of automodRules) {
if (!automodded && rule.name && await rule.check()) { try {
await rule.action(); if (!automodded && rule.name) {
break; const result = await rule.check();
if (result) await rule.action();
}
} catch(y) {
Logger.console('error', 'Automod', y);
} }
} }
}; };