From 50d8059e9f04517b2a88bf0a56c41912b19f3c80 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Tue, 6 Aug 2024 21:08:31 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=A7=81=E8=81=8Aban=E5=90=8E=E7=BE=A4=E7=BB=84=E4=B8=AD?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/builtin_plugins/help_help.py | 6 ++++-- zhenxun/builtin_plugins/hooks/_auth_checker.py | 4 ++-- zhenxun/models/ban_console.py | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/zhenxun/builtin_plugins/help_help.py b/zhenxun/builtin_plugins/help_help.py index 3a8a10ca..4071f203 100644 --- a/zhenxun/builtin_plugins/help_help.py +++ b/zhenxun/builtin_plugins/help_help.py @@ -2,6 +2,7 @@ import os import random from nonebot import on_message +from nonebot.matcher import Matcher from nonebot.plugin import PluginMetadata from nonebot.rule import to_me from nonebot_plugin_alconna import Image, UniMessage, UniMsg @@ -32,7 +33,7 @@ _path = IMAGE_PATH / "_base" / "laugh" @_matcher.handle() -async def _(message: UniMsg, session: EventSession): +async def _(matcher: Matcher, message: UniMsg, session: EventSession): if text := message.extract_plain_text().strip(): if plugin := await PluginInfo.get_or_none( name=text, load_status=True, plugin_type=PluginType.NORMAL @@ -50,4 +51,5 @@ async def _(message: UniMsg, session: EventSession): logger.info( f"检测到功能名称当命令使用,已发送帮助信息", "功能帮助", session=session ) - await UniMessage(message_list).finish(reply_to=True) + await UniMessage(message_list).send(reply_to=True) + matcher.stop_propagation() diff --git a/zhenxun/builtin_plugins/hooks/_auth_checker.py b/zhenxun/builtin_plugins/hooks/_auth_checker.py index 738a7076..4c92dfb3 100644 --- a/zhenxun/builtin_plugins/hooks/_auth_checker.py +++ b/zhenxun/builtin_plugins/hooks/_auth_checker.py @@ -206,9 +206,9 @@ class AuthChecker: if not group_id: group_id = channel_id channel_id = None - if user_id and matcher.plugin and (module := matcher.plugin.name): + if user_id and matcher.plugin and (module_path := matcher.plugin.module_name): user = await UserConsole.get_user(user_id, session.platform) - if plugin := await PluginInfo.get_or_none(module=module): + if plugin := await PluginInfo.get_or_none(module_path=module_path): if plugin.plugin_type == PluginType.HIDDEN: return try: diff --git a/zhenxun/models/ban_console.py b/zhenxun/models/ban_console.py index 9f91438f..607d2879 100644 --- a/zhenxun/models/ban_console.py +++ b/zhenxun/models/ban_console.py @@ -93,6 +93,8 @@ class BanConsole(Model): """ logger.debug(f"获取用户ban时长", target=f"{group_id}:{user_id}") user = await cls._get_data(user_id, group_id) + if not user and user_id: + user = await cls._get_data(user_id, None) if user: if user.duration == -1: return -1