From 0756d39ac542854bd9cb6db41aaf09c0cdd456d2 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Fri, 26 Aug 2022 19:26:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BE=A4=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E6=97=A0=E6=B3=95=E6=B7=BB=E5=8A=A0=E8=AF=8D?= =?UTF-8?q?=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ plugins/word_bank/word_handle.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 766a4359..30d2f469 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,10 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 ## 更新 +### 2022/8/26 + +* 修复群管理员无法添加词条 + ### 2022/8/23 * 修了下模糊匹配 issue#1026 [@pull/1026](https://github.com/HibiKier/zhenxun_bot/pull/1026) diff --git a/plugins/word_bank/word_handle.py b/plugins/word_bank/word_handle.py index 8aa44b54..401562c7 100644 --- a/plugins/word_bank/word_handle.py +++ b/plugins/word_bank/word_handle.py @@ -93,7 +93,7 @@ async def _( state: T_State, reg_group: Tuple[Any, ...] = RegexGroup(), ): - if str(event.user_id) not in bot.config.superusers: + if isinstance(event, PrivateMessageEvent) and str(event.user_id) not in bot.config.superusers: await add_word.finish('权限不足捏') word_scope, word_type, problem, answer = reg_group if ( From e42521f0a3e53b707fa60eae00fef9e17874b73c Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Fri, 26 Aug 2022 19:39:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=8D=E6=9D=A1?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E8=AF=8D"=E9=97=AE"=E5=89=8D=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + plugins/word_bank/word_handle.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30d2f469..a330c641 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,7 @@ PS: **ARM平台** 请使用全量版 同时 **如果你的机器 RAM < 1G 可能 ### 2022/8/26 * 修复群管理员无法添加词条 +* 修复词条关键词"问"前空格问题 ### 2022/8/23 diff --git a/plugins/word_bank/word_handle.py b/plugins/word_bank/word_handle.py index 401562c7..5d6158ed 100644 --- a/plugins/word_bank/word_handle.py +++ b/plugins/word_bank/word_handle.py @@ -130,8 +130,9 @@ async def _( problem = temp break problem = unescape(problem) - index = len((word_scope or "") + "添加词条" + (word_type or "") + problem) + 1 - event.message[0] = event.message[0].data["text"][index + 1 :].strip() + # index = len((word_scope or "") + "添加词条" + (word_type or "") + problem) + 1 + # event.message[0] = event.message[0].data["text"][index + 1 :].strip() + event.message[0] = event.message[0].data["text"].split('答', maxsplit=1)[-1].strip() state["word_scope"] = word_scope state["word_type"] = word_type state["problem"] = problem