[Bug] Sending a Telegram message chain twice duplicates mentions

Open Beginner friendly
#11,125 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@123XieC is already working on this.

Since Nov 14, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

The mention is prepended inside TelegramPlatformEvent.send_with_client, which mutates the caller's MessageChain. Start there and check how the At component's text is added to the Plain component. Copy the chain before prepending, then run the send path twice with a mock Telegram transport and confirm each request contains a single @alice prefix and the original chain is unchanged.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
46.4k
Forks
3.4k
Avg merge
1d 10h
Merged PRs (30d)
111

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AstrBotDevs/AstrBot

All issues in AstrBotDevs/AstrBot

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.