From a9104eb2da6898b41936875248213c63c08bda49 Mon Sep 17 00:00:00 2001 From: jerryliang122 <1261449269@qq.com> Date: Fri, 17 May 2024 08:20:06 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E9=80=9A=E8=BF=87base64=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E5=8F=91=E9=80=81=EF=BC=8C=E4=BF=AE=E5=A4=8Dcqhttp=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=8F=91=E9=80=81=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/platform/sources/aiocqhttp.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/platform/sources/aiocqhttp.py b/pkg/platform/sources/aiocqhttp.py index 8253159c..fc3a89b8 100644 --- a/pkg/platform/sources/aiocqhttp.py +++ b/pkg/platform/sources/aiocqhttp.py @@ -31,13 +31,15 @@ class AiocqhttpMessageConverter(adapter.MessageConverter): msg_time = msg.time elif type(msg) is mirai.Image: arg = '' - - if msg.url: + if hasattr(msg, "base64"): + arg = msg.base64 + msg_list.append(aiocqhttp.MessageSegment.image(f"base64://{arg}")) + elif msg.url: arg = msg.url + msg_list.append(aiocqhttp.MessageSegment.image(arg)) elif msg.path: arg = msg.path - - msg_list.append(aiocqhttp.MessageSegment.image(arg)) + msg_list.append(aiocqhttp.MessageSegment.image(arg)) elif type(msg) is mirai.At: msg_list.append(aiocqhttp.MessageSegment.at(msg.target)) elif type(msg) is mirai.AtAll: From 0b1af7df91d81c1faeb0e769c804bfc1dffa6509 Mon Sep 17 00:00:00 2001 From: RockChinQ <1010553892@qq.com> Date: Fri, 17 May 2024 17:05:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?perf:=20=E7=BB=9F=E4=B8=80=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/platform/sources/aiocqhttp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/platform/sources/aiocqhttp.py b/pkg/platform/sources/aiocqhttp.py index fc3a89b8..4946a1c5 100644 --- a/pkg/platform/sources/aiocqhttp.py +++ b/pkg/platform/sources/aiocqhttp.py @@ -31,7 +31,7 @@ class AiocqhttpMessageConverter(adapter.MessageConverter): msg_time = msg.time elif type(msg) is mirai.Image: arg = '' - if hasattr(msg, "base64"): + if msg.base64: arg = msg.base64 msg_list.append(aiocqhttp.MessageSegment.image(f"base64://{arg}")) elif msg.url: