mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 09:37:50 -05:00
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:
1 parent
627e6f9180
commit
f3983fcf67
8 files changed
+145
-19
No files matched your search
+14
-2
@@ -144,12 +144,18 @@ const wholeNumber = (value, min, max) => (Number.isInteger(value) && value >= mi
|
||||
const ACTION_PERMISSIONS = {
|
||||
ban: "player.ban", banReason: "player.ban", unban: "player.ban",
|
||||
silence: "chat.silence", unsilence: "chat.silence",
|
||||
kick: "player.kick", message: "player.warn", warn: "player.warn",
|
||||
kick: "player.kick", message: "player.warn", warn: "player.warn", unwarn: "player.warn",
|
||||
rejectName: "player.names", acceptName: "player.names", clearBio: "player.names",
|
||||
banAddress: "address.ban",
|
||||
summon: "player.summon", goto: "player.goto",
|
||||
};
|
||||
|
||||
// minutes as a person would say them: "1 hour", "1 day", "90 minutes".
|
||||
const silenceText = minutes => {
|
||||
const [count, unit] = minutes % 1440 === 0 ? [minutes / 1440, "day"] : minutes % 60 === 0 ? [minutes / 60, "hour"] : [minutes, "minute"];
|
||||
return `${count} ${unit}${count === 1 ? "" : "s"}`;
|
||||
};
|
||||
|
||||
const act = (mod, target, body) => {
|
||||
const {actions, PERMANENT} = world.moderation;
|
||||
const name = target.username;
|
||||
@@ -209,9 +215,15 @@ const act = (mod, target, body) => {
|
||||
if (!result) {
|
||||
return {error: `A warning's reason: ${world.moderation.WARNINGS.join(", ")}.`};
|
||||
}
|
||||
return {ok: `${name} warned (${reason}): warning ${result.count}.${result.online ? "" : " They are offline, so they will not see it."}`,
|
||||
return {ok: `${name} warned (${reason}): warning ${result.count}.${result.online ? "" : " They are offline: they will see it when they next play."}`
|
||||
+ (result.silencedMinutes ? ` That many warnings also silenced them for ${silenceText(result.silencedMinutes)}.` : ""),
|
||||
detail: `${reason}${body.note ? ` · ${String(body.note).slice(0, 200)}` : ""}`};
|
||||
}
|
||||
case "unwarn": {
|
||||
const removed = actions.unwarn(target);
|
||||
return removed ? {ok: `Took back ${name}'s latest warning (${removed.reason}).`, detail: removed.reason}
|
||||
: {error: `${name} has no warnings.`};
|
||||
}
|
||||
case "rejectName":
|
||||
if (target.nameRejected) {
|
||||
return {error: "Already rejected."};
|
||||
|
||||
Reference in new issue
Block a user