🐛 fix matcher create missing block (#1859)

This commit is contained in:
Ju4tCode 2023-03-29 10:38:39 +08:00 committed by GitHub
parent 315dcb329e
commit 8fbc85cf50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -118,6 +118,7 @@ def on_message(*args, _depth: int = 0, **kwargs) -> Type[Matcher]:
block: 是否阻止事件向更低优先级传递 block: 是否阻止事件向更低优先级传递
state: 默认 state state: 默认 state
""" """
kwargs.setdefault("block", True)
return on("message", *args, **kwargs, _depth=_depth + 1) return on("message", *args, **kwargs, _depth=_depth + 1)
@ -274,10 +275,9 @@ def on_command(
""" """
commands = {cmd} | (aliases or set()) commands = {cmd} | (aliases or set())
block = kwargs.pop("block", False) kwargs.setdefault("block", False)
return on_message( return on_message(
command(*commands, force_whitespace=force_whitespace) & rule, command(*commands, force_whitespace=force_whitespace) & rule,
block=block,
**kwargs, **kwargs,
_depth=_depth + 1, _depth=_depth + 1,
) )