summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-09-25 18:38:27 -0700
committerFuwn <[email protected]>2025-09-25 18:38:27 -0700
commitcba049451be71cb2f8b6478b2132506c4e4489c7 (patch)
tree9e487f10ff124ad5c962222eaeac2efbf38e632c
parentfix(gateway:aiModeration): Update analysis engine (diff)
downloadumabotdiscord-cba049451be71cb2f8b6478b2132506c4e4489c7.tar.xz
umabotdiscord-cba049451be71cb2f8b6478b2132506c4e4489c7.zip
feat(gateway:aiModeration): Add action skip toggle
-rw-r--r--packages/gateway/src/listeners/aiModeration.ts42
1 files changed, 22 insertions, 20 deletions
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}%)`,