From 8090ebe8cebe071a5835a067cbee271543af7696 Mon Sep 17 00:00:00 2001 From: hibiki <775757368@qq.com> Date: Wed, 18 Aug 2021 01:29:36 +0800 Subject: [PATCH] update hook --- plugins/check_zhenxun_update/data_source.py | 6 +++--- plugins/hook.py | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/check_zhenxun_update/data_source.py b/plugins/check_zhenxun_update/data_source.py index 14ad4c8c..a52b141b 100644 --- a/plugins/check_zhenxun_update/data_source.py +++ b/plugins/check_zhenxun_update/data_source.py @@ -94,9 +94,9 @@ async def check_update(bot: Bot) -> int: width = 0 height = len(update_info.split('\n')) * 24 for m in update_info.split('\n'): - if len(m) * 24 > width: - width = len(m) * 24 - A = CreateImg(800, height, font_size=20) + if len(m) * 20 > width: + width = len(m) * 17 + A = CreateImg(width, height, font_size=20) A.text((10, 10), update_info) A.save(f'{IMAGE_PATH}/update_info.png') return 200 diff --git a/plugins/hook.py b/plugins/hook.py index 93643694..1d4a17b4 100644 --- a/plugins/hook.py +++ b/plugins/hook.py @@ -7,6 +7,7 @@ from nonebot.adapters.cqhttp import ( MessageEvent, PrivateMessageEvent, GroupMessageEvent, + PokeNotifyEvent ) from configs.config import ( BAN_RESULT, @@ -132,10 +133,10 @@ _flmt_c = FreqLimiter(CHECK_NOTICE_INFO_CD) @run_preprocessor async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State): if ( - not isinstance(event, MessageEvent) + (not isinstance(event, MessageEvent) and matcher.module != "poke") or await BanUser.is_ban(event.user_id) or str(event.user_id) in bot.config.superusers - ) and matcher.module != "poke": + ): return module = matcher.module if module in admin_plugins_auth.keys() and matcher.priority not in [1, 9]: @@ -167,8 +168,9 @@ async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State): except ActionFailed: pass raise IgnoredException("权限不足") - if module in plugins2info_dict.keys(): - if isinstance(event, GroupMessageEvent): + if module in plugins2info_dict.keys() and matcher.priority not in [1, 9]: + # 戳一戳单独判断 + if isinstance(event, GroupMessageEvent) or (isinstance(event, PokeNotifyEvent) and event.group_id): # 群权限 if plugins2info_dict[module]["level"] > group_manager.get_group_level( str(event.group_id)