From 364be1e9f6c2755d08a5e54b43204a35cd15ba00 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Tue, 25 Mar 2025 21:21:38 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20Handle=20missing=20defuse?= =?UTF-8?q?dxml=20dependency=20for=20Gewechat=20message=20parsing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/platform/sources/gewechat/client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/astrbot/core/platform/sources/gewechat/client.py b/astrbot/core/platform/sources/gewechat/client.py index 7cedc693c..abab1790b 100644 --- a/astrbot/core/platform/sources/gewechat/client.py +++ b/astrbot/core/platform/sources/gewechat/client.py @@ -14,7 +14,13 @@ from astrbot.api.message_components import Plain, Image, At, Record, Video from astrbot.api.platform import AstrBotMessage, MessageMember, MessageType from astrbot.core.utils.io import download_image_by_url from .downloader import GeweDownloader -from .xml_data_parser import GeweDataParser + +try: + from .xml_data_parser import GeweDataParser +except (ImportError, ModuleNotFoundError) as e: + logger.warning( + f"警告: 可能未安装 defusedxml 依赖库,将导致无法解析微信的 表情包、引用 类型的消息: {str(e)}" + ) class SimpleGewechatClient: