diff options
| author | Fuwn <[email protected]> | 2025-09-25 18:28:07 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-09-25 18:28:07 -0700 |
| commit | f9a5e5f1908fbb352ce2d3092b278d117ccda416 (patch) | |
| tree | e56f29490893d38d191c8a66a22eb9a47b60d2f5 /packages/gateway | |
| parent | fix(gateway:aiModeration): Improve adult content analysis (diff) | |
| download | umabotdiscord-f9a5e5f1908fbb352ce2d3092b278d117ccda416.tar.xz umabotdiscord-f9a5e5f1908fbb352ce2d3092b278d117ccda416.zip | |
fix(gateway:aiModeration): Lint
Diffstat (limited to 'packages/gateway')
| -rw-r--r-- | packages/gateway/src/listeners/aiModeration.ts | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/packages/gateway/src/listeners/aiModeration.ts b/packages/gateway/src/listeners/aiModeration.ts index ef1e3c0..fb2683a 100644 --- a/packages/gateway/src/listeners/aiModeration.ts +++ b/packages/gateway/src/listeners/aiModeration.ts @@ -307,15 +307,20 @@ export const handleAIModeration = (client: Client) => { `AI Moderation: Violation detected - ${analysis.rule} (severity: ${analysis.severity}, confidence: ${analysis.confidence}%)`, ); - if ((analysis.severity === 'critical' || analysis.severity === 'high') && analysis.confidence >= 75) { + if ( + (analysis.severity === "critical" || analysis.severity === "high") && + analysis.confidence >= 75 + ) { try { 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.send(notificationText); - + const notificationMessage = await (message.channel as any).send( + notificationText, + ); + setTimeout(async () => { try { await notificationMessage.delete(); @@ -330,13 +335,21 @@ export const handleAIModeration = (client: Client) => { console.error("Failed to delete message:", error); } } else { - console.log(`AI Moderation: Logging violation for human review (severity: ${analysis.severity}, confidence: ${analysis.confidence}%)`); + console.log( + `AI Moderation: Logging violation for human review (severity: ${analysis.severity}, confidence: ${analysis.confidence}%)`, + ); } const { EmbedBuilder } = await import("discord.js"); - const wasDeleted = (analysis.severity === 'critical' || analysis.severity === 'high') && analysis.confidence >= 85; + const wasDeleted = + (analysis.severity === "critical" || analysis.severity === "high") && + analysis.confidence >= 85; const embed = new EmbedBuilder() - .setTitle(wasDeleted ? "🤖 Message Deleted - Rule Violation" : "⚠️ Rule Violation Detected") + .setTitle( + wasDeleted + ? "🤖 Message Deleted - Rule Violation" + : "⚠️ Rule Violation Detected", + ) .setColor( analysis.severity === "critical" ? "#ff0000" |