_rule中使用messagesegment中未转义的字符串,而添加词条时使用了转义后的字符串,导致二者不一致

This commit is contained in:
LambdaYH 2022-08-22 00:38:25 +08:00
parent 31d4d29f3e
commit 308b76dc7d

View File

@ -128,7 +128,8 @@ async def _(
temp += f"[at:{g.data['qq']}]"
problem = temp
break
index = len((word_scope or "") + "添加词条" + (word_type or "") + unescape(problem)) + 1
problem = unescape(problem)
index = len((word_scope or "") + "添加词条" + (word_type or "") + problem) + 1
event.message[0] = event.message[0].data["text"][index + 1 :].strip()
state["word_scope"] = word_scope
state["word_type"] = word_type
@ -148,7 +149,6 @@ async def _(
try:
if word_type == "正则":
try:
problem = unescape(problem)
re.compile(problem)
except re.error:
await add_word.finish(f"添加词条失败,正则表达式 {problem} 非法!")