完善游戏通知文案与屏蔽逻辑

This commit is contained in:
pllx
2026-04-29 15:06:01 +08:00
parent 6ae452c4b9
commit c640a31302
7 changed files with 199 additions and 45 deletions
+56 -6
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 与绑定标记共同保证偏好读取可控、事件只注册一次。
@@ -483,6 +483,7 @@ export function resolveBlockedSystemSenderKey(msg) {
);
const quizType = String(msg?.quiz_type || "");
const quizTypeLabel = String(msg?.quiz_type_label || "");
const isSystemBroadcast = fromUser === "系统传音" || fromUser === "系统";
// 猜谜活动消息独立作为一个通知类型管理,不再复用“星海小博士”的屏蔽规则。
if (
@@ -491,7 +492,7 @@ export function resolveBlockedSystemSenderKey(msg) {
quizType === "idiom" ||
quizTypeLabel.includes("成语") ||
(fromUser === "星海小博士" && (content.includes("猜成语") || content.includes("猜谜活动"))) ||
((fromUser === "系统传音" || fromUser === "系统") && (content.includes("猜成语") || content.includes("猜谜活动")))
(isSystemBroadcast && (content.includes("猜成语") || content.includes("猜谜活动")))
) {
return "猜成语";
}
@@ -509,22 +510,68 @@ export function resolveBlockedSystemSenderKey(msg) {
}
// 兼容旧版自动钓鱼卡购买通知:历史上该消息曾以"系统传音"发送,但正文里带有"钓鱼播报"字样。
if ((fromUser === "系统传音" || fromUser === "系统") && (content.includes("钓鱼播报") || content.includes("自动钓鱼模式"))) {
if (isSystemBroadcast && (content.includes("钓鱼播报") || content.includes("自动钓鱼模式"))) {
return "钓鱼播报";
}
if ((fromUser === "系统传音" || fromUser === "系统") && content.includes("神秘箱子")) {
// 神秘箱子公告已精简为“《普通箱》...暗号...”等格式,不能再只依赖“神秘箱子”字样。
if (
isSystemBroadcast && (
content.includes("神秘箱子") ||
(content.includes("暗号") && content.includes("《")) ||
content.includes("抢到普通箱") ||
content.includes("抢到黑化箱") ||
content.includes("抢到神秘") ||
content.includes("箱子消失")
)
) {
return "神秘箱子";
}
if ((fromUser === "系统传音" || fromUser === "系统") && content.includes("百家乐")) {
// 百家乐通知已缩短为“开局:...”“🎲 9点...”这类格式,这里同步兼容新旧文案。
if (
isSystemBroadcast && (
content.includes("百家乐") ||
(content.includes("开局:") && content.includes("点收割")) ||
(content.startsWith("🎲") && content.includes("点")) ||
(content.includes("快速参与") && content.includes("1:24"))
)
) {
return "百家乐";
}
if ((fromUser === "系统传音" || fromUser === "系统") && (content.includes("赛马") || content.includes("跑马"))) {
// 赛马通知已缩短为“开赛:...”“比赛开始:...”“冠军:...”等格式。
if (
isSystemBroadcast && (
content.includes("赛马") ||
content.includes("跑马") ||
content.startsWith("🐎 开赛:") ||
content.startsWith("🏇 比赛开始:") ||
content.startsWith("🏆 冠军:")
)
) {
return "跑马";
}
if (isSystemBroadcast && (content.includes("【五子棋】") || content.includes("五子棋"))) {
return "五子棋";
}
if (isSystemBroadcast && (content.includes("老虎机") || content.includes("【老虎机大奖】"))) {
return "老虎机";
}
if (
isSystemBroadcast && (
content.includes("双色球") ||
/购买\s+\d+\s*期/u.test(content) ||
/\d+\s*期:\s*🔴/u.test(content) ||
content.includes("超级期")
)
) {
return "双色球彩票";
}
return null;
}
@@ -605,6 +652,9 @@ export function syncBlockedSystemSenderCheckboxes() {
"block-sender-baccarat": "百家乐",
"block-sender-horse-race": "跑马",
"block-sender-mystery-box": "神秘箱子",
"block-sender-gomoku": "五子棋",
"block-sender-slot-machine": "老虎机",
"block-sender-lottery": "双色球彩票",
};
Object.entries(checkboxMap).forEach(([id, sender]) => {