From 221b31048538dc2751c38866e764473bbd65409e Mon Sep 17 00:00:00 2001 From: ElvisChenML Date: Thu, 25 Jul 2024 16:14:24 +0800 Subject: [PATCH] =?UTF-8?q?Fixed=20aiocqhttp=20mirai.Voice=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=97=A0=E6=B3=95=E6=AD=A3=E7=A1=AE=E4=BC=A0=E9=80=92?= =?UTF-8?q?url=E5=8F=8Abase64=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/platform/sources/aiocqhttp.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/platform/sources/aiocqhttp.py b/pkg/platform/sources/aiocqhttp.py index 4946a1c..ebdd56e 100644 --- a/pkg/platform/sources/aiocqhttp.py +++ b/pkg/platform/sources/aiocqhttp.py @@ -47,7 +47,16 @@ class AiocqhttpMessageConverter(adapter.MessageConverter): elif type(msg) is mirai.Face: msg_list.append(aiocqhttp.MessageSegment.face(msg.face_id)) elif type(msg) is mirai.Voice: - msg_list.append(aiocqhttp.MessageSegment.record(msg.path)) + arg = '' + if msg.base64: + arg = msg.base64 + msg_list.append(aiocqhttp.MessageSegment.record(f"base64://{arg}")) + elif msg.url: + arg = msg.url + msg_list.append(aiocqhttp.MessageSegment.record(arg)) + elif msg.path: + arg = msg.path + msg_list.append(aiocqhttp.MessageSegment.record(msg.path)) elif type(msg) is forward.Forward: for node in msg.node_list: