From a1481fb17970e8b8d9b323754ed011864eb188d2 Mon Sep 17 00:00:00 2001 From: Raven95676 Date: Thu, 10 Apr 2025 14:54:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=A4=E8=81=8A=E5=9C=BA=E6=99=AF=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/platform/sources/telegram/tg_adapter.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/astrbot/core/platform/sources/telegram/tg_adapter.py b/astrbot/core/platform/sources/telegram/tg_adapter.py index 332112880..4aefdb973 100644 --- a/astrbot/core/platform/sources/telegram/tg_adapter.py +++ b/astrbot/core/platform/sources/telegram/tg_adapter.py @@ -247,6 +247,16 @@ class TelegramPlatformAdapter(Platform): # 处理文本消息 plain_text = update.message.text + # 群聊场景命令特殊处理 + if plain_text.startswith("/"): + command_parts = plain_text.split(" ", 1) + if "@" in command_parts[0]: + command, bot_name = command_parts[0].split("@") + if bot_name == self.client.username: + plain_text = command + ( + f" {command_parts[1]}" if len(command_parts) > 1 else "" + ) + if update.message.entities: for entity in update.message.entities: if entity.type == "mention":