From baa2b83df9e837a0d393e5040d32a22d7380d2f9 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Wed, 5 Mar 2025 00:40:38 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20telegram=20cannot=20handl?= =?UTF-8?q?e=20/start=20#620?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/platform/sources/telegram/tg_adapter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/astrbot/core/platform/sources/telegram/tg_adapter.py b/astrbot/core/platform/sources/telegram/tg_adapter.py index c3db89249..f233702f0 100644 --- a/astrbot/core/platform/sources/telegram/tg_adapter.py +++ b/astrbot/core/platform/sources/telegram/tg_adapter.py @@ -24,7 +24,7 @@ from astrbot.api.platform import register_platform_adapter from telegram import Update from telegram.ext import ApplicationBuilder, ContextTypes, filters from telegram.constants import ChatType -from telegram.ext import MessageHandler as TelegramMessageHandler +from telegram.ext import MessageHandler as TelegramMessageHandler, CommandHandler from .tg_event import TelegramPlatformEvent from astrbot.api import logger from telegram.ext import ExtBot @@ -131,6 +131,10 @@ class TelegramPlatformAdapter(Platform): message.message.append(Plain(plain_text)) message.message_str = plain_text + if message.message_str == "/start": + await self.start(update, context) + return + elif update.message.voice: file = await update.message.voice.get_file() message.message = [