feat: honor partial Telegram reply quotes#9236
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for partial quotes in Telegram replies by extracting the quoted text from update.message.quote when available, and updates the mock helpers and tests accordingly. The feedback suggests using getattr to safely access the quote attribute to avoid potential AttributeError exceptions on older library versions, and handling whitespace-only quotes by checking quote_text.strip() along with adding a corresponding test case.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
f08022f to
6cea126
Compare
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
| reply_abm = await self.convert_message(reply_update, context, False) | ||
|
|
||
| if reply_abm: | ||
| quote_text = update.message.quote.text if update.message.quote else None |
There was a problem hiding this comment.
hi, does update.message.quote exists in the previous version of telegram SDK AstrBot using?
I have not double check yet.
There was a problem hiding this comment.
checked.
It does appear cuz Message.quote appeared since v20.8
whereas Astrbot requirements were python-telegram-bot>=22.0 and bumped to >=22.6 in PR #5726
so the attribute exists in both the previous and current supported versions. When a message has no partial quote, its value is simply None, so direct access should be safe.
Fixes #7938
Modifications / 改动点
Use Telegram TextQuote.text as the exact quoted reply content.
Keep the full replied message as the fallback when no non-empty partial quote exists.
Add regression coverage with emoji and a non-zero UTF-16 quote position.
This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
Summary by Sourcery
Honor Telegram partial reply quotes when constructing reply components while preserving existing behavior as a fallback.
New Features:
Enhancements:
Tests: