From 1d79ac232fe8cd90ef91dfe355d32b881e746378 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Fri, 16 Oct 2020 15:12:15 +0800 Subject: [PATCH] :bug: fix missing param for on event --- nonebot/plugin.py | 5 +++-- nonebot/plugin.pyi | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nonebot/plugin.py b/nonebot/plugin.py index 82439f1a..94628b29 100644 --- a/nonebot/plugin.py +++ b/nonebot/plugin.py @@ -27,7 +27,8 @@ class Plugin(object): matcher: Set[Type[Matcher]] -def on(rule: Optional[Union[Rule, RuleChecker]] = None, +def on(type: str = "", + rule: Optional[Union[Rule, RuleChecker]] = None, permission: Optional[Permission] = None, *, handlers: Optional[List[Handler]] = None, @@ -35,7 +36,7 @@ def on(rule: Optional[Union[Rule, RuleChecker]] = None, priority: int = 1, block: bool = False, state: Optional[dict] = None) -> Type[Matcher]: - matcher = Matcher.new("", + matcher = Matcher.new(type, Rule() & rule, permission or Permission(), temp=temp, diff --git a/nonebot/plugin.pyi b/nonebot/plugin.pyi index f75a2ee4..ccb8aed4 100644 --- a/nonebot/plugin.pyi +++ b/nonebot/plugin.pyi @@ -18,7 +18,8 @@ class Plugin(object): matcher: Set[Type[Matcher]] -def on(rule: Optional[Union[Rule, RuleChecker]] = ..., +def on(type: str = ..., + rule: Optional[Union[Rule, RuleChecker]] = ..., permission: Optional[Permission] = ..., *, handlers: Optional[List[Handler]] = ...,