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
28 changes: 0 additions & 28 deletions app/helpers/modLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ export const reportAutomod = async ({
guild,
user,
channelId,
messageId,
ruleName,
matchedKeyword,
actionType,
Expand Down Expand Up @@ -181,33 +180,6 @@ export const reportAutomod = async ({
allowedMentions: { roles: [moderator] },
});

// Record to database if we have a messageId
if (messageId) {
await retry(3, async () => {
const result = await recordReport({
reportedMessageId: messageId,
reportedChannelId: channelId ?? "unknown",
reportedUserId: user.id,
guildId: guild.id,
logMessageId: logMessage.id,
logChannelId: thread.id,
reason: ReportReasons.automod,
extra: `Rule: ${ruleName}`,
});

if (!result.wasInserted) {
log(
"warn",
"reportAutomod",
"duplicate detected at database level, retrying check",
);
throw new Error("Race condition detected in recordReport, retrying…");
}

return result;
});
}

// Forward to mod log
await logMessage.forward(modLog).catch((e) => {
log("error", "reportAutomod", "failed to forward to modLog", { error: e });
Expand Down