From 657e7e52ac74609871a5424a0022929b728f09e0 Mon Sep 17 00:00:00 2001 From: snowy Date: Sun, 2 Jun 2024 15:03:50 +0800 Subject: [PATCH] =?UTF-8?q?:memo:=20=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/plugins/liteyuki_smart_reply/matchers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/liteyuki/plugins/liteyuki_smart_reply/matchers.py b/liteyuki/plugins/liteyuki_smart_reply/matchers.py index 7425e9c..8e18ca8 100644 --- a/liteyuki/plugins/liteyuki_smart_reply/matchers.py +++ b/liteyuki/plugins/liteyuki_smart_reply/matchers.py @@ -85,8 +85,9 @@ async def _(event: T_MessageEvent, bot: Bot, state: T_State, matcher: Matcher): reply = reply.replace("。", "||").replace(",", "||").replace("!", "||").replace("?", "||") replies = reply.split("||") for r in replies: - await asyncio.sleep(random.random() * 2) - await matcher.send(r) + if r: # 防止空字符串 + await asyncio.sleep(random.random() * 2) + await matcher.send(r) else: await asyncio.sleep(random.random() * 3) await matcher.send(reply)