[Bug] Sending a Telegram message chain twice duplicates mentions

オープン 初心者向け
#11,125 コメント 0 件 リアクション 0 件 担当者 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 トランスポートを使って送信パスを 2 回実行してください。各リクエストに @alice のプレフィックスがちょうど 1 つ含まれていること、そして元のチェーンが変更されていないことを確認してください。

索引モデルが 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時間
マージ済み PR(30日)
111

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AstrBotDevs/AstrBot のほかの issue

AstrBotDevs/AstrBot の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。