diff --git a/astrbot/core/platform/sources/telegram/tg_adapter.py b/astrbot/core/platform/sources/telegram/tg_adapter.py index 77fe3e42b..12f17a819 100644 --- a/astrbot/core/platform/sources/telegram/tg_adapter.py +++ b/astrbot/core/platform/sources/telegram/tg_adapter.py @@ -241,5 +241,13 @@ class TelegramPlatformAdapter(Platform): return self.client async def terminate(self): - await self.application.stop() - logger.info("Telegram 适配器已被优雅地关闭") + try: + await self.application.stop() + + # 保险起见先判断是否存在updater对象 + if self.application.updater is not None: + await self.application.updater.stop() + + logger.info("Telegram 适配器已被优雅地关闭") + except Exception as e: + logger.error(f"Telegram 适配器关闭时出错: {e}")