[Bug] Sending a Telegram message chain twice duplicates mentions

未关闭 适合新手
#11,125 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@123XieC 已经在做这个了。

开始于 2026年11月14日。

  • #11126 来自 @123XieC —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

提及内容是在 TelegramPlatformEvent.send_with_client 中前置添加的,这会修改调用方的 MessageChain。请从这里开始,检查 At 组件的文本是如何添加到 Plain 组件中的。在前置添加之前复制该链,然后使用模拟的 Telegram 传输层运行两次发送路径。确认每个请求只包含一个 @alice 前缀,并且原始链保持不变。

由索引模型根据 Issue 内容生成。

描述

Bug description

The Telegram adapter prepends an At mention directly to the caller's Plain.text. A plugin that sends one MessageChain twice (for example, broadcasting a shared notice or retrying delivery) gets duplicate mentions in the second message. The original chain is also changed for subsequent use.

Reproduction

Create MessageChain([At(qq=1234, name="alice"), Plain("Please review")]) and call TelegramPlatformEvent.send_with_client twice with the same chain. A mock Telegram bot is enough to observe the outgoing requests.

Expected result

Each request sends @alice Please review, and the chain's plain component still contains Please review.

Actual result

The second request sends @alice @alice Please review. The component text now contains both prefixes.

Environment

Source at 23db1ad08064a8330a09077138ce8ecc05362219, Python 3.12, macOS. Reproduced with the production send method and the repository's mock Telegram transport.

主要语言
Python
星标
46.4k
派生
3.4k
平均合并
1 天 10 小时
30 天内合并 PR
111

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AstrBotDevs/AstrBot 的其他 Issue

查看 AstrBotDevs/AstrBot 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。