拆分猜成语独立屏蔽通知类型

This commit is contained in:
pllx
2026-04-29 11:35:14 +08:00
parent fb4a7171f4
commit 578f587941
4 changed files with 19 additions and 3 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
// 聊天室共享运行时状态,桥接 Blade 闭包作用域与 Vite 模块。
// 所有需要跨模块共享的可变状态集中在此管理,通过 window.chatState 访问。
export const BLOCKABLE_SYSTEM_SENDERS = ["钓鱼播报", "星海小博士", "百家乐", "跑马", "神秘箱子"];
export const BLOCKABLE_SYSTEM_SENDERS = ["钓鱼播报", "猜成语", "星海小博士", "百家乐", "跑马", "神秘箱子"];
export const BLOCKED_SYSTEM_SENDERS_STORAGE_KEY = "chat_blocked_system_senders";
export const CHAT_SOUND_MUTED_STORAGE_KEY = "chat_sound_muted";
export const PUBLIC_MESSAGE_NODE_LIMIT = 600;
+12 -1
View File
@@ -1,6 +1,6 @@
// 聊天室偏好与每日状态工具,承接从 Blade 内联脚本迁移出的纯数据规整逻辑。
export const BLOCKABLE_SYSTEM_SENDERS = ["钓鱼播报", "星海小博士", "百家乐", "跑马", "神秘箱子"];
export const BLOCKABLE_SYSTEM_SENDERS = ["钓鱼播报", "猜成语", "星海小博士", "百家乐", "跑马", "神秘箱子"];
export const BLOCKED_SYSTEM_SENDERS_STORAGE_KEY = "chat_blocked_system_senders";
export const CHAT_SOUND_MUTED_STORAGE_KEY = "chat_sound_muted";
// 白名单、localStorage key 与绑定标记共同保证偏好读取可控、事件只注册一次。
@@ -476,6 +476,16 @@ export function shouldMigrateLocalChatPreferences(serverPreferences, localBlocke
export function resolveBlockedSystemSenderKey(msg) {
const fromUser = String(msg?.from_user || "");
const content = String(msg?.content || "");
const action = String(msg?.action || "");
const idiomRoundId = Number.parseInt(
String(msg?.idiom_game_round_id || msg?.idom_game_round_id || msg?.idiom_game_round_ended_id || "0"),
10,
);
// 猜成语消息独立作为一个通知类型管理,不再复用“星海小博士”的屏蔽规则。
if (idiomRoundId > 0 || action === "idiom_result" || (fromUser === "星海小博士" && content.includes("猜成语"))) {
return "猜成语";
}
if (fromUser === "钓鱼播报") {
return "钓鱼播报";
@@ -581,6 +591,7 @@ export function syncBlockedSystemSenderCheckboxes() {
const checkboxMap = {
"block-sender-fishing": "钓鱼播报",
"block-sender-idiom": "猜成语",
"block-sender-doctor": "星海小博士",
"block-sender-baccarat": "百家乐",
"block-sender-horse-race": "跑马",