From ba2efec62a0ba8e368b5b8b473e15a57c90b7a61 Mon Sep 17 00:00:00 2001 From: G41mywaifu <81564864+G41mywaifu@users.noreply.github.com> Date: Sat, 16 Oct 2021 08:46:20 +0800 Subject: [PATCH] Update __init__.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "朋友“替换成任意名称 --- plugins/one_friend/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/one_friend/__init__.py b/plugins/one_friend/__init__.py index 6e175b87..325420a9 100644 --- a/plugins/one_friend/__init__.py +++ b/plugins/one_friend/__init__.py @@ -66,8 +66,11 @@ async def _(bot: Bot, event: GroupMessageEvent, state: T_State): at_user = await bot.get_group_member_info(group_id=event.group_id, user_id=qq) user_name = at_user["card"] if at_user["card"] else at_user["nickname"] msg = re.search( - r"^我.*?朋友.*?(想问问|说|让我问问|想问|让我问|想知道|让我帮他问问|让我帮他问|让我帮忙问|让我帮忙问问|问)(.*)", msg + r"^(.*)想问问(.*)", msg ) + name=msg.group(1) + if not name: + user_name=name msg = msg.group(2) if not msg: msg = "都不知道问什么"