Support /subtlenotify

In oldclient, it'll be treated like `/nonotify`. In newclient, it'll
do a subtle notification, which according to #2641 is desirable
in some cases.
This commit is contained in:
Guangcong Luo
2026-05-21 15:38:13 +00:00
parent b1f7bb6302
commit 0162aaf3fe
3 changed files with 7 additions and 2 deletions

View File

@@ -1254,6 +1254,7 @@
case 'raw':
return { message: '<div class="chat chatmessage-' + toID(name) + '">' + BattleLog.sanitizeHTML(target) + '</div>', noNotify: isNotPM };
case 'nonotify':
case 'subtlenotify':
return { message: '<div class="chat">' + timestamp + BattleLog.sanitizeHTML(target) + '</div>', noNotify: true };
case 'challenge':
return { challenge: target };

View File

@@ -142,7 +142,7 @@ export class BattleLog {
}
let divClass = 'chat';
let divHTML = '';
let noNotify: boolean | undefined;
let noNotify: boolean | 'subtle' | undefined;
if (!['name', 'n'].includes(args[0])) this.lastRename = null;
switch (args[0]) {
case 'chat': case 'c': case 'c:':
@@ -1232,7 +1232,7 @@ export class BattleLog {
parseChatMessage(
message: string, name: string, timestamp: string, isHighlighted?: boolean
): [divClass: string, divHTML: string, noNotify?: boolean] {
): [divClass: string, divHTML: string, noNotify?: boolean | 'subtle'] {
let showMe = !BattleLog.prefs('chatformatting')?.hideme;
let group = ' ';
if (!/[A-Za-z0-9]/.test(name.charAt(0))) {
@@ -1320,6 +1320,8 @@ export class BattleLog {
return ['chat', BattleLog.sanitizeHTML(target), true];
case 'nonotify':
return ['chat', BattleLog.sanitizeHTML(target), true];
case 'subtlenotify':
return ['chat', BattleLog.sanitizeHTML(target), 'subtle'];
default:
// Not a command or unsupported. Parsed as a normal chat message.
if (!name) {

View File

@@ -158,6 +158,8 @@ export class ChatRoom extends PSRoom {
title: `${this.title}`,
body: textContent,
});
} else if (noNotify === 'subtle') {
this.subtleNotify();
}
} else {
this.subtleNotify();