Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug] Telegram 群聊中发给其他机器人的命令会误唤醒 AstrBot

Open Beginner friendly
#10,240 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@fzf404 is already working on this.

Since Sep 26, 2026.

  • #10241 by @fzf404 — open
  • #10244 by @EterUltimate — closed without merging

Assessment

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

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 处理。

如何复现

  1. 在同一个 Telegram 群聊中加入 AstrBot 和另一个机器人,并确保 AstrBot 能收到普通群消息。
  2. 向另一个机器人发送命令,例如 /help@OtherBot。
  3. 观察 AstrBot 也收到该消息,并可能进入唤醒或 LLM 回复流程。

预期行为

  • /help@CurrentBot:由当前 AstrBot 接收,并规范为 /help。
  • /help@OtherBot:在 Telegram 适配层忽略,不进入 AstrBot 事件总线。
  • /help:保持现有行为,由 AstrBot 的唤醒和命令配置决定是否处理。

实际行为

发给其他机器人的定向命令会保留 / 前缀进入 AstrBot 通用唤醒流程,可能错误唤醒当前机器人。

修复建议

在 Telegram 适配器现有的定向命令规范化逻辑中:

  1. 使用大小写不敏感的方式比较命令目标与当前 Bot 用户名;
  2. 目标为当前 Bot 时移除用户名后缀;
  3. 目标为其他 Bot 时停止转换该消息;
  4. 不改变无目标裸命令的现有行为。

该问题与 #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

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.