[Bug] Telegram 群聊中发给其他机器人的命令会误唤醒 AstrBot
Maintainers usually reply within 1 day
@fzf404 is already working on this.
Since Sep 26, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start in the Telegram adapter's targeted-command normalization logic and trace how messages enter the event bus and generic wakeup stage. Verify the three described cases: current-bot targets lose the suffix, other-bot targets are ignored, and bare commands retain their existing behavior.
Written by the indexing model from the issue text.
Description
问题描述
在 Telegram 群聊中,当 AstrBot 收到形如 /help@OtherBot 的命令时,Telegram 适配器只会对发给当前机器人的命令移除 @bot_username,但会将发给其他机器人的命令原样传入事件总线。
AstrBot 的通用唤醒阶段会先根据 / 前缀判断消息是否唤醒,再匹配具体命令。因此 /help@OtherBot 虽然并非发给当前机器人,仍可能唤醒 AstrBot 并进入后续 LLM 处理。
如何复现
- 在同一个 Telegram 群聊中加入 AstrBot 和另一个机器人,并确保 AstrBot 能收到普通群消息。
- 向另一个机器人发送命令,例如
/help@OtherBot。 - 观察 AstrBot 也收到该消息,并可能进入唤醒或 LLM 回复流程。
预期行为
/help@CurrentBot:由当前 AstrBot 接收,并规范为/help。/help@OtherBot:在 Telegram 适配层忽略,不进入 AstrBot 事件总线。/help:保持现有行为,由 AstrBot 的唤醒和命令配置决定是否处理。
实际行为
发给其他机器人的定向命令会保留 / 前缀进入 AstrBot 通用唤醒流程,可能错误唤醒当前机器人。
修复建议
在 Telegram 适配器现有的定向命令规范化逻辑中:
- 使用大小写不敏感的方式比较命令目标与当前 Bot 用户名;
- 目标为当前 Bot 时移除用户名后缀;
- 目标为其他 Bot 时停止转换该消息;
- 不改变无目标裸命令的现有行为。
该问题与 #10232 的共同点是都需要在 Telegram 适配层正确表达消息归属,但一个处理命令目标,另一个处理被回复消息的发送者标识,建议分别修复和审核。
环境
- AstrBot:当前
master - 平台:Telegram
- 部署方式:Docker Compose
- 该问题不会产生异常日志
- Dominant language
- Python
- Stars
- 41.4k
- Forks
- 3k
- Avg merge
- 1d
- Merged PRs (30d)
- 131
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AstrBotDevs/AstrBot
-
Text-to-image rendering suppresses asyncio task cancellationPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
AstrBotDevs/AstrBot#10389 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
AstrBotDevs/AstrBot#10388 ·
Maintainers usually reply within 1 day
-
Boxlite boot treats any HTTP response as a healthy sandboxPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
AstrBotDevs/AstrBot#10385 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AstrBotDevs/AstrBot#10378 · 1 comment ·
Maintainers usually reply within 1 day
-
[Feature] 移除「切换到旧版知识库」入口Possibly taken @silvaling claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AstrBotDevs/AstrBot#10340 ·
Maintainers usually reply within 1 day
All issues in AstrBotDevs/AstrBot
Similar issues
-
feature:LinkChecker
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
digitalfabrik/integreat-cms#4594 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
EleutherAI/lm-evaluation-harness#4319 ·
Maintainers usually reply within 1 day
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
json_params_matcher fails on falsy top-level JSON primitives (0, False, "")Possibly taken @mayureshsonawane17 claimed this today. OpenWaiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 5 days