Plugin Info
{
"name": "astrbot_plugin_qqofficial_quote",
"display_name": "QQ官方引用消息适配",
"desc": "为 QQ 官方适配器(qq_official / qq_official_webhook)补全群聊/私聊引用消息(回复消息)的解析能力,通过 monkey-patch 将 QQ 平台推送的 msg_elements 转换为 AstrBot 标准 Reply 组件,使机器人能感知用户引用了什么内容",
"author": "yuweitk",
"repo": "https://github.com/yuweitk/astrbot_plugin_qqofficial_quote",
"tags": ["QQ", "qq_official", "引用消息", "Reply", "monkey-patch"],
"social_link": "https://github.com/yuweitk"
}
Check List
Description
本插件通过 monkey-patch 技术,在不修改 AstrBot 源码的前提下,补全 QQ 官方适配器对引用消息的解析能力。
问题背景:
QQ 官方 API 在用户回复(引用)消息时,推送的 payload 中 message_type=103,被引用内容在 msg_elements 字段。但 botpy SDK 的消息类使用 slots 限定字段,不保存 msg_elements,导致数据在 SDK 层面被丢弃。AstrBot 其他适配器(aiocqhttp/lark/satori/weixin_oc)均已实现引用消息解析,下游管道也已完整支持 Reply 组件处理,缺口仅在 QQ 官方适配器上游。
解决方案:
三层 patch:
- patch botpy ConnectionState 的 parser 方法 - 捕获 msg_elements
- patch QQOfficialWebhook.handle_callback - Webhook 模式额外保险
- patch QQOfficialPlatformAdapter._parse_from_qqofficial - 构造 Reply 组件注入消息链
参考实现: https://github.com/NousResearch/hermes-agent (gateway/platforms/qqbot)
Plugin Info
{ "name": "astrbot_plugin_qqofficial_quote", "display_name": "QQ官方引用消息适配", "desc": "为 QQ 官方适配器(qq_official / qq_official_webhook)补全群聊/私聊引用消息(回复消息)的解析能力,通过 monkey-patch 将 QQ 平台推送的 msg_elements 转换为 AstrBot 标准 Reply 组件,使机器人能感知用户引用了什么内容", "author": "yuweitk", "repo": "https://github.com/yuweitk/astrbot_plugin_qqofficial_quote", "tags": ["QQ", "qq_official", "引用消息", "Reply", "monkey-patch"], "social_link": "https://github.com/yuweitk" }Check List
Description
本插件通过 monkey-patch 技术,在不修改 AstrBot 源码的前提下,补全 QQ 官方适配器对引用消息的解析能力。
问题背景:
QQ 官方 API 在用户回复(引用)消息时,推送的 payload 中 message_type=103,被引用内容在 msg_elements 字段。但 botpy SDK 的消息类使用 slots 限定字段,不保存 msg_elements,导致数据在 SDK 层面被丢弃。AstrBot 其他适配器(aiocqhttp/lark/satori/weixin_oc)均已实现引用消息解析,下游管道也已完整支持 Reply 组件处理,缺口仅在 QQ 官方适配器上游。
解决方案:
三层 patch:
参考实现: https://github.com/NousResearch/hermes-agent (gateway/platforms/qqbot)