fix🐛: 修复词条回答包含at时使用模糊|正则等问时无法正确匹配问题

This commit is contained in:
HibiKier 2023-08-20 23:45:31 +08:00
parent 38abb74c4c
commit 0a4df8296e
2 changed files with 10 additions and 3 deletions

View File

@ -331,6 +331,10 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能
## 更新
### 2022/8/20
* 修复词条回答包含at时使用模糊|正则等问时无法正确匹配问题
### 2023/8/7
* 添加 本地图库插件 防吞图特性 [@pull/1468](https://github.com/HibiKier/zhenxun_bot/pull/1468)

View File

@ -134,9 +134,10 @@ async def _(
answer = ""
problem = ""
for index, seg in enumerate(event.message):
if seg.type == "text" and "添加词条问" in str(seg) and is_first:
r = re.search("添加词条(模糊|正则|图片)?问", str(seg))
if seg.type == "text" and r and is_first:
is_first = False
seg_ = str(seg).split("添加词条")[-1]
seg_ = str(seg).split(f"添加词条{r.group(1) or ''}")[-1]
cur_p = "problem"
# 纯文本
if "" in seg_:
@ -302,7 +303,9 @@ async def _(bot: Bot, event: GroupMessageEvent, arg: Message = CommandArg()):
):
await show_word_matcher.finish("gid必须为数字且在范围内")
gid = int(gid)
msg_list = await show_word(problem, id_, gid, None if gid else str(event.group_id))
msg_list = await show_word(
problem, id_, gid, None if gid else str(event.group_id)
)
else:
msg_list = await show_word(problem, None, None, str(event.group_id))
if isinstance(msg_list, str):