From c38fa77ce65e5da6e58ba4f72436eee1dfa155e9 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 9 Mar 2025 18:10:38 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=E4=BF=AE=E5=A4=8D=20gewe?= =?UTF-8?q?chat=20=E9=83=A8=E5=88=86=E5=9C=BA=E6=99=AF=E4=B8=8B=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=9B=BE=E7=89=87=E6=8A=A5=E9=94=99=20#700?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/platform/sources/gewechat/client.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/astrbot/core/platform/sources/gewechat/client.py b/astrbot/core/platform/sources/gewechat/client.py index 49c1ebee5..1c3b8bd0b 100644 --- a/astrbot/core/platform/sources/gewechat/client.py +++ b/astrbot/core/platform/sources/gewechat/client.py @@ -186,12 +186,17 @@ class SimpleGewechatClient: abm.message_str = content case 3: # 图片消息 - file_url = await self.multimedia_downloader.download_image( - self.appid, content - ) - logger.debug(f"下载图片: {file_url}") - file_path = await download_image_by_url(file_url) - abm.message.append(Image(file=file_path, url=file_path)) + # 先看看 base64 数据 + if "ImgBuf" in d and "buffer" in d["ImgBuf"]: + logger.debug("发现图片消息包含 base64 数据,使用。") + abm.message.append(Image.fromBase64(d["ImgBuf"]["buffer"])) + else: + file_url = await self.multimedia_downloader.download_image( + self.appid, content + ) + logger.debug(f"下载图片: {file_url}") + file_path = await download_image_by_url(file_url) + abm.message.append(Image(file=file_path, url=file_path)) case 34: # 语音消息