跳到正文
DEV Community· Tal·· 8 小時前AI 評分46

版主紀錄應記下決策原因,而不只是處理結果

Your mod log records what happened. It should record why.

AI 導讀

版主紀錄若只保存處理結果和簡短理由,難以在申訴時説明決策依據。文章建議把每項處理記作個案,記錄違規原因、證據及申訴方式,並把理由聲明快照保存在申訴紀錄中。自動化決策須標明並交由真人覆核;一般紀錄保留六個月,與申索相關的紀錄保留六年。

正文

Most moderation systems store the same five columns: guild, user, moderator, action, reason. That looks like a record until someone appeals, at which point it turns out to be a note to self.

The reason column is the problem. In practice it holds "spam", "rule 4", or "being annoying". A fortnight later, a member asks why they were muted and the honest answer is that the moderator who did it can't remember either. So the argument becomes about memory, and the member usually wins, because they were there.

What a decision actually needs to answer

Four questions, and a free-text field answers none of them reliably:

  1. What happened, specifically?
  2. Which rule was breached?
  3. What evidence was considered?
  4. What can the member do about it?

If your schema can't answer those from the record alone, it isn't really a log. It's a rumour with a timestamp attached.

The shape we landed on

Every action is a case with a stable id, the target, the moderator, an action type from a fixed enum, a reason, and whether it is still active:

const infractionSchema = new mongoose.Schema({
  guildId: { type: String, required: true },
  userId: { type: String, required: true },
  moderatorId: { type: String, required: true },
  type: { type: String, enum: ['warning', 'mute', 'kick', 'ban', 'timeout', 'softban', 'unban', 'unmute'], required: true },
  reason: { type: String, required: true },
  duration: { type: Number, default: null },
  active: { type: Boolean, default: true },
});

reason stays required, and the bot refuses to write an empty one. That single constraint removes most of the "why was I banned" threads, because the answer is already written down at the moment somebody cared enough to write it.

The second piece is a generator that turns a decision into a readable statement. It's a pure function, deterministic, and there's no LLM anywhere near it:

function buildStatementOfReasons({ caseId, guildName, targetUser, actionType, reason, severity, automated, evidenceCount, decisionDate }) {
  const action = ACTION_LABELS[actionType] || 'A moderation action was applied';
  const points = [
    `Affected user: ${targetUser || 'the account concerned'}.`,
    `What happened: ${action} against ${targetUser} (case ${caseId}) on ${new Date(date).toUTCString()}.`,
    `Why: the action was taken for a ${sev}infringement of our Acceptable Use Policy. Specific reason recorded: "${reason}".`,
    evidenceRef,
    basis,
  ];
  // ... plus an appeal paragraph and the statutory basis
}

The output is five lines a human can read, and the same structured fields get snapshotted onto the appeal record.

The part that is easy to get wrong: automated decisions

If an action came from automod or image screening, the statement has to say so, and the appeal has to reach a human. That isn't a formality. It's the difference between "the bot muted you" and "the bot muted you, and here's who looks at it":

const AUTOMATED_BASIS =
  'This decision was made by automated tools (including AI media moderation) ' +
  'and has been recorded so a human can review it on request.';

So the appeal record carries an automatedDecision flag, and the review path forces a human decision when it is set. The status lifecycle is deliberately narrow: pending, then upheld, overturned or dismissed. No "in review" state that quietly lives forever.

Snapshot, don't join

The appeal stores a copy of the statement as it was at the time of the decision. Joining back to the live infraction looks tidier and is worse: the reason gets edited, the moderator leaves, a retention job deletes the case, and now the appeal is arguing about a record that doesn't exist any more. Snapshot the statement, keep the case id for reference, and treat the snapshot as immutable.

Retention is the other half. We purge general records at six months and keep claim-related ones for six years. Pick your numbers before you need them, because "we deleted it" is a hopeless answer to an appeal.

If you're not building this

Three changes get you most of the way in an afternoon:

  • Make the reason structured: a rule code plus the message id, not a sentence.
  • Never delete a case. Mark it inactive.
  • Write the appeal instructions into the record at creation, not into a help page nobody reads.

The legal framing is useful here. The EU Digital Services Act Article 17 requires a clear, specific statement of reasons for certain moderation decisions, and the UK Online Safety Act has an equivalent appeal framing. Most Discord servers aren't platforms in the statutory sense, and this isn't legal advice. But it's a good specification for a database schema, and the shape it forces is the shape that settles the argument.

If you want to see it in the app, the bot is at sighnet.org. The moderation dashboard is on the free tier.

來源:DEV Community · dev.to