This repository was archived by the owner on Oct 9, 2026. It is now read-only.
Repository navigation
fix: OneBot reads media and replies in its string message format - #33
Merged
Merged
Conversation
mekjr1
force-pushed
the
fix/onebot-cq-string-media
branch
from
October 7, 2026 19:34
8bf07d4 to
0518ebd
Compare
A OneBot implementation set to post messages as a string sends text with CQ codes, such as [CQ:image,file=a.png,url=...]. parseSegments only looked for a mention of the bot in that format, so its media was never downloaded and the agent got the codes as text. The string is now split into the array format's segments, with OneBot's escapes undone, and read the same way.
mekjr1
force-pushed
the
fix/onebot-cq-string-media
branch
from
October 7, 2026 19:53
0518ebd to
d3da47a
Compare
This was referenced Oct 8, 2026
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
A OneBot implementation can post messages in two formats: an array of segments (the default), or a string with CQ codes, such as
see [CQ:image,file=a.png,url=https://...] here, when set tomessage_post_format: string. For the string format,parseSegments(pkg/channels/onebot/onebot.go) only looked for a mention of the bot. So its pictures, videos, files and voice messages were never downloaded, replies weren't read, and the agent got the CQ codes as text.cqSegmentsnow splits the string into the array format's segments, undoing OneBot's escapes ([],&), and the same loop reads both formats. Media is downloaded and tagged in place (#21); mentions, replies and faces work as in the array format. CQ codes of other kinds are dropped from the text, as their segments are in the array format.Tests:
TestParseMessageSegments_StringFormatandTestParseSegments_StringFormatReplyAndMention; both fail without the fix.