Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/middlewares/auto-moderation-stack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,23 @@ export class AutoModerationStack<C extends TelemetryContextFlavor<Context>> exte
const muteDuration = duration.zod.parse(MULTI_CHAT_SPAM.MUTE_DURATION)

const res = await Moderation.multiChatSpam(ctx.from, similarMessages, muteDuration)

if (res.isErr()) {
logger.error({ error: res.error }, "Cannot execute moderation action for MULTI_CHAT_SPAM")
return
}

void ephemeral(
ctx.reply(
fmt(
({ i, b, n }) => [
i`Message for ${fmtUser(ctx.from)}.`,
b`⚠️ Your message was detected as potential spam and has been deleted.`,
n`Please avoid sending similar messages to multiple groups/topics in a short period of time. Try again in 5 minutes.`,
],
{ sep: "\n" }
)
)
)
Comment thread
lorenzocorallo marked this conversation as resolved.
}
}
}
Loading