From dae092402dfe6ef27990dd2ab32ec64b738ee369 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 14 Mar 2022 13:01:10 +0000 Subject: [PATCH] auto fix by pre-commit hooks --- src/plugins/nonebot_bison/config_manager.py | 4 +++- tests/test_config_manager_admin.py | 16 ++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/plugins/nonebot_bison/config_manager.py b/src/plugins/nonebot_bison/config_manager.py index e701779..7e7255e 100644 --- a/src/plugins/nonebot_bison/config_manager.py +++ b/src/plugins/nonebot_bison/config_manager.py @@ -294,12 +294,14 @@ del_sub_matcher = on_command( del_sub_matcher.handle()(set_target_user_info) do_del_sub(del_sub_matcher) -group_manage_matcher = on_command("群管理",rule=to_me(),permission=SUPERUSER,priority=4) +group_manage_matcher = on_command("群管理", rule=to_me(), permission=SUPERUSER, priority=4) + @group_manage_matcher.handle() async def send_group_list(bot: Bot, event: GroupMessageEvent, state: T_State): await group_manage_matcher.finish(Message("该功能只支持私聊使用,请私聊Bot")) + @group_manage_matcher.handle() async def send_group_list(bot: Bot, event: PrivateMessageEvent, state: T_State): groups = await bot.call_api("get_group_list") diff --git a/tests/test_config_manager_admin.py b/tests/test_config_manager_admin.py index 77e9ac1..877edbf 100644 --- a/tests/test_config_manager_admin.py +++ b/tests/test_config_manager_admin.py @@ -1,8 +1,13 @@ +import pytest from nonebug import App -from .utils import fake_admin_user, fake_private_message_event, fake_group_message_event, fake_superuser +from .utils import ( + fake_admin_user, + fake_group_message_event, + fake_private_message_event, + fake_superuser, +) -import pytest @pytest.mark.asyncio async def test_query_with_superuser_private(app: App): @@ -48,6 +53,7 @@ async def test_query_with_superuser_private(app: App): ctx.should_pass_rule() ctx.should_pass_permission() + @pytest.mark.asyncio async def test_query_with_superuser_group_tome(app: App): from nonebot.adapters.onebot.v11.bot import Bot @@ -57,11 +63,9 @@ async def test_query_with_superuser_group_tome(app: App): async with app.test_matcher(group_manage_matcher) as ctx: bot = ctx.create_bot(base=Bot) event = fake_group_message_event( - message=Message("群管理"), sender=fake_superuser,to_me=True + message=Message("群管理"), sender=fake_superuser, to_me=True ) ctx.receive_event(bot, event) ctx.should_pass_rule() ctx.should_pass_permission() - ctx.should_call_send( - event, '', True - ) \ No newline at end of file + ctx.should_call_send(event, "", True)