Warnings: shown at the next visit, taken back, and a silence for many

- a warning given while the player is away is kept and shown with the
  game's popup once they are next in a room (the latest one)
- unwarn: "Take back latest" in the moderator panel, !unwarn in game and
  from the staff window ("xmd")
- config.warningSilence: the Nth warning within some days also silences
  (3rd: an hour, 5th: a day, by default)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
SnipzilandClaude Opus 5.5 committed 2026-10-16 22:43:28 -04:00
1 parent 627e6f9180
commit f3983fcf67
8 files changed
+145 -19

No files matched your search

+29 -1
View File
@@ -682,7 +682,8 @@ module.exports = ({findOnline, players, watchers, sendItemList, blocks, setHideB
const reason = WARNINGS.includes(asked) ? asked : "behavior";
const note = (WARNINGS.includes(asked) ? rest.slice(1) : rest).join(" ").trim().slice(0, MAX_WARNING);
const result = actions.warn(target.account, reason, session.account.username, note);
tell(session, `${target.account.username} warned (${reason}): warning ${result.count}.`);
tell(session, `${target.account.username} warned (${reason}): warning ${result.count}.`
+ (result.silencedMinutes ? ` Silenced for ${result.silencedMinutes} minutes, for that many warnings.` : ""));
logged(session, "warn", target, note ? `${reason} · ${note}` : reason);
});
},
@@ -707,6 +708,33 @@ module.exports = ({findOnline, players, watchers, sendItemList, blocks, setHideB
});
},
},
// "!unwarn PLAYER": takes back their latest warning (one given by
// mistake), online or not.
unwarn: {
permission: "player.warn",
run(session, words) {
const account = splitAccount(words);
if (!account) {
tell(session, words.length ? `No player called ${words.join(" ")}.` : "Use: !unwarn PLAYER");
return;
}
if (account === session.account) {
tell(session, "That is you.");
return;
}
if (!roles.outranks(session.account, account)) {
tell(session, "Staff of your rank or above are for someone higher up to deal with.");
return;
}
const removed = staffModeration().actions.unwarn(account);
if (!removed) {
tell(session, `${account.username} has no warnings.`);
return;
}
tell(session, `Took back ${account.username}'s latest warning (${removed.reason}).`);
modlog.record(session.account.username, "unwarn (in game)", account.username, removed.reason);
},
},
// "!warnings PLAYER": their latest warnings, online or not.
warnings: {
permission: "player.warn",