From cba049451be71cb2f8b6478b2132506c4e4489c7 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 25 Sep 2025 18:38:27 -0700 Subject: feat(gateway:aiModeration): Add action skip toggle --- packages/gateway/src/listeners/aiModeration.ts | 42 ++++++++++++++------------ 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'packages/gateway/src') diff --git a/packages/gateway/src/listeners/aiModeration.ts b/packages/gateway/src/listeners/aiModeration.ts index 3a42d76..03087aa 100644 --- a/packages/gateway/src/listeners/aiModeration.ts +++ b/packages/gateway/src/listeners/aiModeration.ts @@ -7,6 +7,7 @@ import { } from "discord.js"; import { sendAuditLog } from "../commands/utilities"; +const SKIP_ACTION = false; const EXCLUDED_CATEGORIES = [ "1406422619934167103", // Staff "1420604833286852608", // Staff Automation @@ -314,29 +315,30 @@ export const handleAIModeration = (client: Client) => { (analysis.severity === "critical" || analysis.severity === "high") && analysis.confidence >= 75 ) { - try { - await message.delete(); - console.log(`AI Moderation: Auto-deleted high severity violation`); - + if (!SKIP_ACTION) try { - const notificationText = `${message.author}, your message was deleted: **${analysis.brief}**. This notification will be deleted in 10 seconds.`; - const notificationMessage = await (message.channel as any).send( - notificationText, - ); - - setTimeout(async () => { - try { - await notificationMessage.delete(); - } catch (error) { - console.error("Failed to delete notification message:", error); - } - }, 10000); + await message.delete(); + console.log(`AI Moderation: Auto-deleted high severity violation`); + + try { + const notificationText = `${message.author}, your message was deleted: **${analysis.brief}**. This notification will be deleted in 10 seconds.`; + const notificationMessage = await (message.channel as any).send( + notificationText, + ); + + setTimeout(async () => { + try { + await notificationMessage.delete(); + } catch (error) { + console.error("Failed to delete notification message:", error); + } + }, 10000); + } catch (error) { + console.error("Failed to send notification message:", error); + } } catch (error) { - console.error("Failed to send notification message:", error); + console.error("Failed to delete message:", error); } - } catch (error) { - console.error("Failed to delete message:", error); - } } else { console.log( `AI Moderation: Logging violation for human review (severity: ${analysis.severity}, confidence: ${analysis.confidence}%)`, -- cgit v1.2.3