From 08e6537d4a1cf6ec0f72e8546ee4f7831fa7a48a Mon Sep 17 00:00:00 2001 From: c3b2a <62082214+c3b2a@users.noreply.github.com> Date: Tue, 19 Jan 2021 17:42:55 +0800 Subject: [PATCH] =?UTF-8?q?bug=20=E4=BF=AE=E5=A4=8D=20(#97)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update keyword.py * Update list.json --- keyword.py | 7 +++++-- list.json | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/keyword.py b/keyword.py index 2c930ed..ef073a7 100644 --- a/keyword.py +++ b/keyword.py @@ -352,7 +352,7 @@ async def auto_reply(context): n_mode = n_settings.get("mode", None) mode = "0" g_list = g_settings.get("list", None) - n_list = g_settings.get("list", None) + n_list = n_settings.get("list", None) user_list = [] if g_mode and n_mode: mode = n_mode elif g_mode or n_mode: mode = g_mode if g_mode else n_mode @@ -370,10 +370,13 @@ async def auto_reply(context): if validate(str(sender_id), int(mode), user_list): last_time = time.time() catch_pattern = r"\$\{regex_(?P((?!\}).)+)\}" - while re.search(catch_pattern, v): + count = 0 + while re.search(catch_pattern, v) and count < 20: search_data = re.search(k, send_text) group_name = re.search(catch_pattern, v).group("str") capture_data = get_capture(search_data, group_name) if not capture_data: capture_data = "" + if re.search(catch_pattern, capture_data): capture_data = "" v = v.replace("${regex_%s}" % group_name, capture_data) + count += 1 await send_reply(chat_id, parse_multi(v), context) diff --git a/list.json b/list.json index c727172..0fc1098 100644 --- a/list.json +++ b/list.json @@ -362,10 +362,10 @@ }, { "name": "keyword", - "version": "1.4", + "version": "1.5", "section": "chat", "maintainer": "c3b2a", - "size": "15.6 kb", + "size": "15.4 kb", "supported": true, "des-short": "群组关键词自动回复插件", "des": "命令: keyword, replyset。"