From 8fbc85cf5048af21bf5b08153bfd003af75c0696 Mon Sep 17 00:00:00 2001 From: Ju4tCode <42488585+yanyongyu@users.noreply.github.com> Date: Wed, 29 Mar 2023 10:38:39 +0800 Subject: [PATCH] :bug: fix matcher create missing block (#1859) --- nonebot/plugin/on.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonebot/plugin/on.py b/nonebot/plugin/on.py index 55909e8a..c1f43982 100644 --- a/nonebot/plugin/on.py +++ b/nonebot/plugin/on.py @@ -118,6 +118,7 @@ def on_message(*args, _depth: int = 0, **kwargs) -> Type[Matcher]: block: 是否阻止事件向更低优先级传递 state: 默认 state """ + kwargs.setdefault("block", True) return on("message", *args, **kwargs, _depth=_depth + 1) @@ -274,10 +275,9 @@ def on_command( """ commands = {cmd} | (aliases or set()) - block = kwargs.pop("block", False) + kwargs.setdefault("block", False) return on_message( command(*commands, force_whitespace=force_whitespace) & rule, - block=block, **kwargs, _depth=_depth + 1, )