mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-10-26 20:27:05 -05:00
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:
@@ -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 };
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -158,6 +158,8 @@ export class ChatRoom extends PSRoom {
|
||||
title: `${this.title}`,
|
||||
body: textContent,
|
||||
});
|
||||
} else if (noNotify === 'subtle') {
|
||||
this.subtleNotify();
|
||||
}
|
||||
} else {
|
||||
this.subtleNotify();
|
||||
|
||||
Reference in New Issue
Block a user