From 19ad67a77f05488c84376772c0698d1db07ca2d6 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Wed, 2 Apr 2025 16:24:36 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=E4=BF=AE=E5=A4=8D=20aioc?= =?UTF-8?q?qhttp=20=E9=80=82=E9=85=8D=E5=99=A8=E4=B8=8B=E7=A9=BA=E7=99=BD?= =?UTF-8?q?=20plain=20=E5=AF=BC=E8=87=B4=E7=9A=84=20the=20object=20is=20no?= =?UTF-8?q?t=20a=20proper=20segment=20chain=20=E6=8A=A5=E9=94=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/sources/aiocqhttp/aiocqhttp_message_event.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_message_event.py b/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_message_event.py index c7aede7d1..295014ab4 100644 --- a/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_message_event.py +++ b/astrbot/core/platform/sources/aiocqhttp/aiocqhttp_message_event.py @@ -22,6 +22,9 @@ class AiocqhttpMessageEvent(AstrMessageEvent): if isinstance(segment, Plain): d["type"] = "text" d["data"]["text"] = segment.text.strip() + # 如果是空文本或者只带换行符的文本,不发送 + if not d["data"]["text"]: + continue elif isinstance(segment, (Image, Record)): # convert to base64 bs64 = await segment.convert_to_base64() @@ -38,6 +41,9 @@ class AiocqhttpMessageEvent(AstrMessageEvent): async def send(self, message: MessageChain): ret = await AiocqhttpMessageEvent._parse_onebot_json(message) + if not ret: + return + send_one_by_one = False for seg in message.chain: if isinstance(seg, (Node, Nodes)):