From 050654b2a927be5eb62a2feb85fd29a34584ab41 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Tue, 11 Mar 2025 22:08:13 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=E4=BF=AE=E5=A4=8D=20QQ?= =?UTF-8?q?=20=E5=AE=98=E6=96=B9=E6=9C=BA=E5=99=A8=E4=BA=BA=E9=80=82?= =?UTF-8?q?=E9=85=8D=E5=99=A8=E4=B8=8B=E5=8F=91=E9=80=81base64=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=B6=88=E6=81=AF=E6=AE=B5=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: shuiping233 <1944680304@qq.com> --- .../sources/qqofficial/qqofficial_message_event.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py b/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py index 987c98164..d31006618 100644 --- a/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py +++ b/astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py @@ -122,16 +122,16 @@ class QQOfficialMessageEvent(AstrMessageEvent): plain_text += i.text elif isinstance(i, Image) and not image_base64: if i.file and i.file.startswith("file:///"): - image_base64 = file_to_base64(i.file[8:]).replace("base64://", "") + image_base64 = file_to_base64(i.file[8:]) image_file_path = i.file[8:] elif i.file and i.file.startswith("http"): image_file_path = await download_image_by_url(i.file) - image_base64 = file_to_base64(image_file_path).replace( - "base64://", "" - ) + image_base64 = file_to_base64(image_file_path) + elif i.file and i.file.startswith("base64://"): + image_base64 = i.file else: - image_base64 = i.file.replace("base64://", "") - image_file_path = i.file + image_base64 = file_to_base64(i.file) + image_base64 = image_base64.removeprefix("base64://") else: logger.debug(f"qq_official 忽略 {i.type}") return plain_text, image_base64, image_file_path