-
Notifications
You must be signed in to change notification settings - Fork 284
fix(msg): 修复图文混排时超级表情截断及接收端解析中断 #866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
linyuchen
merged 7 commits into
LLOneBot:dev
from
VincentZyu233:fix/mixed-super-face-and-parsing-break
Sep 30, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a42c169
fix(msg): 修复图文混排时超级表情导致的截断与接收端解析中断
VincentZyu233 6296b9e
fix(msg): 接收超级大表情时跳过紧随其后的降级文本段
VincentZyu233 a2aa759
docs(msg): 完善超级表情 fallback 降级文本跳过逻辑注释与实测案例
VincentZyu233 f9cef0d
docs(msg): 补充发送端混排超级表情的 QQ 服务端协议约束与防呆说明
VincentZyu233 34869a3
docs: 补充超级表情与多元素图文混排协议降级机制文档索引
VincentZyu233 9fba353
docs(msg): 补充发送端混排降级判定与单体合法性校验注释
VincentZyu233 84efc7a
docs(msg): 进一步润色发送端混排判定与消息段长度约束注释措辞
VincentZyu233 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # 超级表情与多元素图文混排协议备忘 | ||
|
|
||
| ## 1. 协议背景与服务类型定义 | ||
|
|
||
| QQ 协议中的表情元素包含多种服务类型(`serviceType`): | ||
|
|
||
| - **普通表情 / 经典小黄脸**:直接通过 `elem.face` 呈现。 | ||
| - **行内小表情 (`serviceType: 33`, `QSmallFaceExtra`)**:包含小黄脸、超级表情的行内小表情形态。 | ||
| - **全屏超级大表情 (`serviceType: 37`, `LargeFaceExtra`)**:包含带动画的超级大表情(如 `/吃糖`、`/菜汪`)、骰子(Dice)和猜拳(RPS)的互动大动画形态。 | ||
|
|
||
| --- | ||
|
|
||
| ## 2. 发送端规则 (MessageBuilding) | ||
|
|
||
| ### 2.1 混排降级机制 | ||
| - **单体唯一表情 (`inputElems.length === 1`)**: | ||
| 构造 `serviceType: 37`(`LargeFaceExtra`),此时客户端正常播放全屏大表情或骰子掷点动画。 | ||
| - **图文混排 (`inputElems.length > 1`)**: | ||
| **必须降级为 `serviceType: 33`(`QSmallFaceExtra`)**。 | ||
| - **原因**:腾讯 QQ 服务端严格禁止在多元素混排消息中包含 `serviceType: 37`,否则会直接拦截并抛出 `retcode: 1200`(发送失败); | ||
| - **表现**:官方 QQ 客户端在输入框中混排输入超级表情/互动表情时,底层行为与视觉表现均自动降级为行内小表情形态。 | ||
|
|
||
| --- | ||
|
|
||
| ## 3. 接收端规则 (MessageParsing) | ||
|
|
||
| ### 3.1 降级文本 (Fallback Text) 处理 | ||
| - **腾讯服务端下发逻辑**: | ||
| 当用户发送单张超级大表情(`serviceType: 37`)时,为了兼容旧版 QQ / TIM 等老旧客户端,腾讯服务器会在数据包中紧随其后附带一个纯文本元素(例如 `[吃糖]`、`[菜汪]` 或 `[动画表情]`)。 | ||
| - **解析与清洗规范**: | ||
| - 严禁在解析完 `serviceType: 37` 后直接调用 `break`,否则会中断后续元素遍历,误杀后续真正的聊天消息; | ||
| - 应当智能检测紧随其后的下一个元素(`elems[index + 1]`),若其内容匹配该表情的 fallback 降级纯文本(如 `[${faceName}]`、`[动画表情]` 等),则标记 `skipIndex = index + 1` 精准跳过该冗余段。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.