AstrBot
AstrBot copied to clipboard
[Bug]Telegram 适配器对附件消息的 caption 处理不一致
What happened / 发生了什么
当前观察到:
photo分支会把caption写入message.message_str,并追加Comp.Plain(...)document分支没有处理captionvideo分支也没有处理caption
Reproduce / 如何复现?
- 在 Telegram 中发送一个文件或视频
- 同时填写说明文字(caption)
- 上层插件只能拿到
Comp.File/Comp.Video event.message_str为空,说明文字丢失
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
telegram平台适配器
OS
Linux
Logs / 报错日志
建议统一处理 Telegram 附件 caption,至少覆盖:
photodocumentvideo
Are you willing to submit a PR? / 你愿意提交 PR 吗?
- [x] Yes!
Code of Conduct
- [x] I have read and agree to abide by the project's Code of Conduct。
确认这个 bug 存在。问题代码位于 tg_adapter.py 的 convert_message 函数:
- photo(第 453-466 行):正确处理了
caption,写入message_str并追加Comp.Plain,还处理了caption_entities的 mention - document(第 477-488 行):完全忽略 caption ❌
- video(第 490-499 行):完全忽略 caption ❌
修复方案:在 document 和 video 分支中添加与 photo 相同的 caption 处理逻辑。另外建议也检查 audio、animation 等其他媒体类型是否有同样问题。
To reply, just mention @dosu.
Docs are dead. Just use Dosu.