From bc117038fb1bdf27061c07488a99f80c1ae26a88 Mon Sep 17 00:00:00 2001 From: ZouZhang <61148270+Zzzzzzouhang@users.noreply.github.com> Date: Wed, 24 Jun 2026 22:15:12 +0800 Subject: [PATCH] fix: preserve At components when sending messages on qq_official platform (#8983) - Add At component handling in _parse_to_qqofficial method - Convert At(qq=openid) to <@openid> plain_text format - Maintain original message chain order by appending - Skip At(qq='all') since QQ Official API may not support it Closes #8982 --- .../platform/sources/qqofficial/qqofficial_message_event.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py b/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py index 68a93b09b..f19f15354 100644 --- a/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py +++ b/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py @@ -25,7 +25,7 @@ from tenacity import ( from astrbot.api import logger from astrbot.api.event import AstrMessageEvent, MessageChain -from astrbot.api.message_components import File, Image, Plain, Record, Video +from astrbot.api.message_components import At, File, Image, Plain, Record, Video from astrbot.api.platform import AstrBotMessage, PlatformMetadata from astrbot.core.utils.media_utils import MediaResolver, file_uri_to_path, is_file_uri @@ -747,6 +747,10 @@ class QQOfficialMessageEvent(AstrMessageEvent): file_source = file_path elif i.url: file_source = i.url + elif isinstance(i, At): + qq_id = getattr(i, "qq", "") + if qq_id and qq_id != "all": + plain_text += f"<@{qq_id}>" else: logger.debug(f"qq_official 忽略 {i.type}") return (