Skip to content

Commit 710a208

Browse files
committed
Adds durations to default ban and lock messages.
1 parent 4e63558 commit 710a208

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

server/chat-commands/moderation.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
import { Utils } from '../../lib';
1212
import { type RoomSection, RoomSections } from './room-settings';
13+
import { ROOMBAN_DURATION, LOCK_DURATION } from '../../server/punishments';
1314

1415
/* eslint no-else-return: "error" */
1516

@@ -788,17 +789,19 @@ export const commands: Chat.ChatCommands = {
788789
Monitor.log(`[CrisisMonitor] Trusted user ${targetUser.name} ${(targetUser.trusted !== targetUser.id ? ` (${targetUser.trusted})` : ``)} was roombanned from ${room.roomid} by ${user.name}, and should probably be demoted.`);
789790
}
790791

792+
const durationMsg = week ? 'a week' : Chat.toDurationString(ROOMBAN_DURATION);
793+
791794
if (targetUser.id in room.users || user.can('lock')) {
792795
targetUser.popup(
793796
`|modal||html|<p>${Utils.escapeHTML(user.name)} has banned you from the room ${room.roomid} ` +
794-
`${(room.subRooms ? ` and its subrooms` : ``)}${week ? ' for a week' : ''}.` +
797+
`${(room.subRooms ? ` and its subrooms` : ``)} for ${durationMsg}.` +
795798
`</p>${(publicReason ? `<p>Reason: ${Utils.escapeHTML(publicReason)}</p>` : ``)}` +
796799
`<p>To appeal the ban, PM the staff member that banned you${room.persist ? ` or a room owner. ` +
797800
`</p><p><button name="send" value="/roomauth ${room.roomid}">List Room Staff</button></p>` : `.</p>`}`
798801
);
799802
}
800803

801-
this.addModAction(`${name} was banned${week ? ' for a week' : ''} from ${room.title} by ${user.name}.${publicReason ? ` (${publicReason})` : ``}`);
804+
this.addModAction(`${name} was banned for ${durationMsg} from ${room.title} by ${user.name}.${publicReason ? ` (${publicReason})` : ``}`);
802805

803806
const time = week ? Date.now() + 7 * 24 * 60 * 60 * 1000 : null;
804807
const affected = Punishments.roomBan(room, targetUser, time, null, privateReason);
@@ -928,8 +931,8 @@ export const commands: Chat.ChatCommands = {
928931
(force ? `FORCE` : ``) + (week ? "WEEKLOCK" : (month ? "MONTHLOCK" : "LOCK")), targetUser || userid, privateReason
929932
);
930933

931-
const durationMsg = week ? ' for a week' : (month ? ' for a month' : '');
932-
this.addGlobalModAction(`${name} was locked from talking${durationMsg} by ${user.name}.` + (publicReason ? ` (${publicReason})` : ""));
934+
const durationMsg = week ? 'a week' : (month ? 'a month' : Chat.toDurationString(LOCK_DURATION));
935+
this.addGlobalModAction(`${name} was locked from talking for ${durationMsg} by ${user.name}.` + (publicReason ? ` (${publicReason})` : ""));
933936

934937
if (room && !room.settings.isHelp) {
935938
room.hideText([
@@ -949,7 +952,7 @@ export const commands: Chat.ChatCommands = {
949952
}
950953

951954
if (targetUser) {
952-
let message = `|popup||html|${user.name} has locked you from talking in chats, battles, and PMing regular users${durationMsg}`;
955+
let message = `|popup||html|${user.name} has locked you from talking in chats, battles, and PMing regular users for ${durationMsg}`;
953956
if (publicReason) message += `\n\nReason: ${publicReason}`;
954957

955958
let appeal = '';

server/punishments.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ const SHAREDIPS_BLACKLIST_FILE = 'config/sharedips-blacklist.tsv';
2121
const WHITELISTED_NAMES_FILE = 'config/name-whitelist.tsv';
2222

2323
const RANGELOCK_DURATION = 60 * 60 * 1000; // 1 hour
24-
const LOCK_DURATION = 48 * 60 * 60 * 1000; // 48 hours
24+
export const LOCK_DURATION = 48 * 60 * 60 * 1000; // 48 hours
2525
const GLOBALBAN_DURATION = 7 * 24 * 60 * 60 * 1000; // 1 week
2626
const BATTLEBAN_DURATION = 48 * 60 * 60 * 1000; // 48 hours
2727
const GROUPCHATBAN_DURATION = 7 * 24 * 60 * 60 * 1000; // 1 week
2828
const MOBILE_PUNISHMENT_DURATIION = 6 * 60 * 60 * 1000; // 6 hours
2929

30-
const ROOMBAN_DURATION = 48 * 60 * 60 * 1000; // 48 hours
30+
export const ROOMBAN_DURATION = 48 * 60 * 60 * 1000; // 48 hours
3131
const BLACKLIST_DURATION = 365 * 24 * 60 * 60 * 1000; // 1 year
3232

3333
const USERID_REGEX = /^[a-z0-9]+$/;

0 commit comments

Comments
 (0)