mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-15 17:30:13 +08:00
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
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user