From 0beb3dfdfac4d46cfdd21b777950f6fedb64d3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Thu, 11 Dec 2025 15:29:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E9=9F=B3=E4=B9=90?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E6=B6=88=E6=81=AF=E7=9A=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E5=8F=96=E6=AD=8C=E6=9B=B2=E5=92=8C=E6=AD=8C?= =?UTF-8?q?=E6=89=8B=E4=BF=A1=E6=81=AF=E5=B9=B6=E6=9E=84=E5=BB=BA=E7=9B=B8?= =?UTF-8?q?=E5=BA=94=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recv_handler/message_handler.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/recv_handler/message_handler.py b/src/recv_handler/message_handler.py index 14c2c6e..10d01d8 100644 --- a/src/recv_handler/message_handler.py +++ b/src/recv_handler/message_handler.py @@ -521,6 +521,22 @@ class MessageHandler: return Seg(type="text", data=announce_text) + # 检查是否为音乐卡片 + if app == "com.tencent.music.lua" or app == "com.tencent.structmsg": + meta = parsed_json.get("meta", {}) + music = meta.get("music", {}) + + # 尝试从music字段提取信息 + if music: + title = music.get("title", "") + singer = music.get("singer", "") + music_text = "[音乐卡片]" + if title: + music_text += f"\n歌曲: {title}" + if singer: + music_text += f"\n歌手: {singer}" + return Seg(type="text", data=music_text) + # 其他卡片消息使用prompt字段 prompt = parsed_json.get("prompt", "[卡片消息]") return Seg(type="text", data=prompt)