Skip to content

Conversation

@u0-ani-nya
Copy link
Contributor

@u0-ani-nya u0-ani-nya commented Oct 1, 2025

Add handling for bot replies in group messages.

fixes #XYZ


Motivation / 动机

将回复机器人的消息视为唤醒机器人

Modifications / 改动点

tg_adapter.py : line 267

        if (message.type == MessageType.GROUP_MESSAGE and update.message.reply_to_message and update.message.reply_to_message.from_user.id == context.bot.id):
            plain_text2 = f"/@{context.bot.username} " + plain_text
            plain_text = plain_text2

Verification Steps / 验证步骤

Screenshots or Test Results / 运行截图或测试结果

Compatibility & Breaking Changes / 兼容性与破坏性变更

  • 这是一个破坏性变更 (Breaking Change)。/ This is a breaking change.
  • 这不是一个破坏性变更。/ This is NOT a breaking change.

Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

Sourcery 总结

新功能:

  • 在群聊中,将对机器人的回复视为命令,做法是在消息文本前添加 '/@BotUsername '
Original summary in English

Summary by Sourcery

New Features:

  • Treat replies to the bot in group chats as commands by prepending '/@BotUsername ' to the message text

Add handling for bot replies in group messages.
@auto-assign auto-assign bot requested review from Raven95676 and Soulter October 1, 2025 08:26
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你好 - 我已经审阅了你的更改,它们看起来很棒!


Sourcery 对开源项目免费 - 如果你喜欢我们的评审,请考虑分享它们 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我将使用这些反馈来改进你的评审。
Original comment in English

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@u0-ani-nya
Copy link
Contributor Author

写代码比较渣哈
ui也不太会写配置表单
但是回复激活是有了(

@Soulter Soulter changed the title 对于telegram群聊,将回复机器人的消息视为唤醒机器人 perf: 对于telegram群聊,将回复机器人的消息视为唤醒机器人 Oct 1, 2025
@Soulter Soulter changed the title perf: 对于telegram群聊,将回复机器人的消息视为唤醒机器人 perf: 对于 Telegram 群聊,将回复机器人的消息视为唤醒机器人 Oct 1, 2025
@Soulter Soulter merged commit 5eaf03e into AstrBotDevs:master Oct 1, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants