bug 修复 (#97)

* Update keyword.py

* Update list.json
This commit is contained in:
c3b2a 2021-01-19 17:42:55 +08:00 committed by GitHub
parent 0677e12c5c
commit 08e6537d4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -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<str>((?!\}).)+)\}"
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)

View File

@ -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。"