修复猜成语出题消息线上不显示问题

This commit is contained in:
pllx
2026-04-29 11:25:57 +08:00
parent dc9c09c722
commit fb4a7171f4
2 changed files with 63 additions and 2 deletions
@@ -121,6 +121,23 @@ export function appendMessage(msg, renderBatch = null) {
state.trackMaxMsgId(msg.id || 0);
const idiomRoundId = Number.parseInt(
String(msg.idiom_game_round_id || msg.idom_game_round_id || "0"),
10,
);
const isIdiomStartMessage = idiomRoundId > 0
&& msg.from_user === "星海小博士"
&& !msg.action
&& String(msg.content || "").includes("猜成语时间");
if (isIdiomStartMessage) {
const existingIdiomNode = document.querySelector(`[data-idiom-round-id="${idiomRoundId}"]`);
if (existingIdiomNode) {
attachIdiomAnswerButton(existingIdiomNode, msg);
return existingIdiomNode;
}
}
const isMe = msg.from_user === window.chatContext?.username;
const fontColor = msg.font_color || "#000000";
const blockRuleKey = resolveBlockedSystemSenderKey(msg);
@@ -131,6 +148,9 @@ export function appendMessage(msg, renderBatch = null) {
if (msg?.from_user) {
div.dataset.fromUser = msg.from_user;
}
if (idiomRoundId > 0) {
div.dataset.idiomRoundId = String(idiomRoundId);
}
if (blockRuleKey) {
div.dataset.blockKey = blockRuleKey;
}