Conversation
Introduces a new `telegram_reply_to_message` configuration option, allowing users to control whether the bot automatically quotes the original message when sending a reply. This behavior can be set for `private` chats, `group` chats, `all` chats, or turned `off`. This provides greater flexibility in how the bot interacts in different Telegram chat environments. Additionally, this commit improves the resolution of sender nicknames for Telegram messages, prioritizing a combination of first/last name and username for a more comprehensive display.
This improves the user experience and internationalization of the recently introduced 'telegram_reply_to_message' configuration by providing clear, localized labels for its options in the dashboard.
When the `telegram_reply_to_message` configuration is set to prevent replies, remove any `Reply` components that may have been added to the message chain by other global settings. This ensures the Telegram platform's specific setting to disable quoting is always respected, overriding any default reply behavior.
Feat/telegram reply to message
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="astrbot/core/platform/sources/telegram/tg_adapter.py" line_range="764" />
<code_context>
platform_meta=self.meta(),
session_id=message.session_id,
client=self.client,
+ reply_to_message=self.reply_to_message,
)
</code_context>
<issue_to_address>
**issue (broader_impact):** The reply-to configuration is propagated to `TelegramPlatformEvent`, but `send_streaming` never uses it when constructing the Telegram payload. Streaming responses therefore do not quote the triggering message even when `telegram_reply_to_message` is set to `private`, `group`, or `all`.
**Triggers:** When Telegram streaming responses are enabled and reply quoting is configured.
**Suggested fix:** Apply the same `should_reply` logic to the streaming payload and include the triggering message ID for the supported Telegram send operations.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if the setting or scope logic is wrong, Telegram responses can be sent with an incorrect reply association or have an explicit Reply component suppressed, and those messages remain visible after a revert. The configuration can be changed back and future responses recover, but already-sent messages cannot be fully restored by rerunning the bot.
Blocking findings: astrbot/core/platform/sources/telegram/tg_adapter.py:764
1 similar comment
|
no comment |
g2nnyS
left a comment
There was a problem hiding this comment.
I need more context to generate a professional GitHub issue response. Please provide the specific issue content, the background of the discussion, or the exact question that needs to be addressed.
g2nnyS
left a comment
There was a problem hiding this comment.
Could you please provide the specific details or the content of the GitHub issue for which you need a professional reply drafted? This will help me create an accurate and contextually appropriate response.
This pull request introduces a new configuration option to control whether the Telegram bot replies by quoting (replying to) the original message that triggered its response. The change is implemented end-to-end: from configuration, through platform logic, to the user interface and internationalization. The default behavior is not to quote messages, but users can now choose to enable quoting in private chats, group chats, or both.
Key changes include:
Telegram Bot Reply-to Behavior
telegram_reply_to_message(with values:off,private,group,all) to control the reply quoting behavior for Telegram bot responses. This includes updates to the default config, config schema, and i18n files for English, Chinese, and Russian. [1] [2] [3] [4] [5]tg_adapter.py) and event (tg_event.py) logic to respect this configuration: when enabled, the bot will quote the triggering message in the appropriate chat context; when disabled, any reply components are stripped from outgoing messages to ensure no quoting occurs. [1] [2] [3] [4] [5] [6]User Display Improvements
These changes provide more flexible and user-friendly control over how the Telegram bot interacts in conversations, matching user preferences and platform expectations.
Modifications / 改动点
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
[] 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
📚 I checked the affected WebUI instructions and screenshots in
docs/zhanddocs/enagainst the changed navigation, page structure, and labels, and updated them in this PR (or explained why no documentation update is needed). For renamed, moved, or merged entry points, I included an old entry → new entry mapping in the documentation and changelog./ 我已对照变化后的 WebUI 入口、页面结构和术语,核对并在本 PR 中更新
docs/zh和docs/en的相关操作说明与截图(或说明无需更新文档的原因)。入口改名、移动或合并时,已在文档和 changelog 中补充 旧入口 → 新入口 对照。🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Allow users to control whether Telegram bot responses quote the triggering message while improving sender identification.
New Features:
Enhancements: