From ffc31b305c4d42c119ba58a7f394ab6cde55ac77 Mon Sep 17 00:00:00 2001 From: NayukiMeko Date: Fri, 1 May 2026 00:41:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(#7904):=20QQ=E5=AE=98=E6=96=B9=E7=A7=81?= =?UTF-8?q?=E8=81=8A=E4=B8=BB=E5=8A=A8=E6=8E=A8=E9=80=81=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=9B=A0=E7=BC=BA=E5=B0=91=E7=BC=93=E5=AD=98=20msg=5Fid=20?= =?UTF-8?q?=E8=80=8C=E8=B7=B3=E8=BF=87=E5=8F=91=E9=80=81=20(#7914)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: QQ官方私聊主动推送不再因缺少缓存 msg_id 而跳过发送 (#7904) - 私聊场景下 _send_by_session_common 在无缓存 msg_id 时提前 return, 导致重启后 cron 等主动推送的消息无法发送。 - 私聊主动推送不需要 msg_id,跳过此检查。 * test: 补充 QQ 官方群聊有缓存 msg_id 时正常发送的测试 (#7904) * Delete tests/unit/test_qqofficial_adapter.py --------- Co-authored-by: Weilong Liao <37870767+Soulter@users.noreply.github.com> --- .../platform/sources/qqofficial/qqofficial_platform_adapter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/astrbot/core/platform/sources/qqofficial/qqofficial_platform_adapter.py b/astrbot/core/platform/sources/qqofficial/qqofficial_platform_adapter.py index 3037ab2d8..27880e548 100644 --- a/astrbot/core/platform/sources/qqofficial/qqofficial_platform_adapter.py +++ b/astrbot/core/platform/sources/qqofficial/qqofficial_platform_adapter.py @@ -222,8 +222,9 @@ class QQOfficialPlatformAdapter(Platform): ): return + # 私聊主动推送不需要 msg_id,见 https://github.com/AstrBotDevs/AstrBot/issues/7904 msg_id = self._session_last_message_id.get(session.session_id) - if not msg_id: + if not msg_id and session.message_type != MessageType.FRIEND_MESSAGE: logger.warning( "[QQOfficial] No cached msg_id for session: %s, skip send_by_session", session.session_id,