Merge pull request #36 from felinae98/bug/group-manage

fix #30
This commit is contained in:
felinae98 2022-03-17 10:51:28 +08:00 committed by GitHub
commit 936fd20919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 48 deletions

View File

@ -360,13 +360,13 @@ async def do_dispatch_command(
"message",
Rule(),
permission,
None,
True,
handlers=None,
temp=True,
priority=0,
block=True,
plugin=matcher.plugin,
module=matcher.module,
expire_time=datetime.now() + bot.config.session_expire_timeout,
expire_time=datetime.now(),
default_state=matcher.state,
default_type_updater=matcher.__class__._default_type_updater,
default_permission_updater=matcher.__class__._default_permission_updater,
@ -379,34 +379,3 @@ async def do_dispatch_command(
do_del_sub(new_matcher)
new_matcher_ins = new_matcher()
asyncio.create_task(new_matcher_ins.run(bot, event, state))
test_matcher = on_command("testtt")
@test_matcher.handle()
async def _handler(bot: Bot, event: Event, matcher: Matcher, state: T_State):
permission = await matcher.update_permission(bot, event)
new_matcher = Matcher.new(
"message",
Rule(),
permission,
None,
True,
priority=0,
block=True,
plugin=matcher.plugin,
module=matcher.module,
expire_time=datetime.now() + bot.config.session_expire_timeout,
default_state=matcher.state,
default_type_updater=matcher.__class__._default_type_updater,
default_permission_updater=matcher.__class__._default_permission_updater,
)
async def h():
logger.warning("yes")
await new_matcher.send("666")
new_matcher.handle()(h)
new_matcher_ins = new_matcher()
await new_matcher_ins.run(bot, event, state)

View File

@ -453,17 +453,3 @@ async def test_del_sub(app: App):
ctx.should_finished()
subs = config.list_subscribe(10000, "group")
assert len(subs) == 0
async def test_test(app: App):
from nonebot.adapters.onebot.v11.bot import Bot
from nonebot.adapters.onebot.v11.message import Message
from nonebot_bison.config_manager import test_matcher
async with app.test_matcher(test_matcher) as ctx:
bot = ctx.create_bot(base=Bot)
event = fake_group_message_event(message=Message("testtt"))
ctx.receive_event(bot, event)
ctx.should_pass_permission()
ctx.should_pass_rule()
ctx.should_call_send(event, "666", True)