fix: split long Telegram captions into media + text messages#907
Closed
jalehman wants to merge 3 commits intoopenclaw:mainfrom
Closed
fix: split long Telegram captions into media + text messages#907jalehman wants to merge 3 commits intoopenclaw:mainfrom
jalehman wants to merge 3 commits intoopenclaw:mainfrom
Conversation
When sending media with text exceeding Telegram's 1024 character caption limit, the API returns 'message caption is too long' error. This fix: - Adds TELEGRAM_MAX_CAPTION_LENGTH constant (1024) - Detects when text exceeds the limit while sending media - Sends media first without caption, then sends text as follow-up message - Preserves thread params, reply markup, and HTML parsing in follow-up - Returns the text message ID as the main message ID Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Address code review feedback: - Follow-up text now uses plain text to match caption behavior (no HTML conversion) - reply_markup (buttons) only appears on follow-up text when splitting, not on the media message - Added tests for reply_markup behavior with split captions Co-Authored-By: Claude <[email protected]>
steipete
added a commit
that referenced
this pull request
Jan 14, 2026
Co-authored-by: Josh Lehman <[email protected]>
Contributor
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
Co-authored-by: Josh Lehman <[email protected]>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When sending media with text exceeding Telegram's 1024 character caption limit, the API returns
message caption is too longerror.Problem
Sending audio/images with long text captions fails:
Solution
This fix:
TELEGRAM_MAX_CAPTION_LENGTHconstant (1024)Testing
Generated with Claude Code
Co-Authored-By: Claude [email protected]