From 785eac1345a98aea25cabe975250329f938cb944 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Sat, 13 Mar 2021 15:35:13 +0800 Subject: [PATCH] :label: fix regex rule typing error --- nonebot/plugin/__init__.py | 2 +- nonebot/plugin/__init__.pyi | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nonebot/plugin/__init__.py b/nonebot/plugin/__init__.py index b9ed77ed..bd9fec3d 100644 --- a/nonebot/plugin/__init__.py +++ b/nonebot/plugin/__init__.py @@ -489,7 +489,7 @@ def on_shell_command(cmd: Union[str, Tuple[str, ...]], def on_regex(pattern: str, flags: Union[int, re.RegexFlag] = 0, - rule: Optional[Rule] = None, + rule: Optional[Union[Rule, T_RuleChecker]] = None, **kwargs) -> Type[Matcher]: """ :说明: diff --git a/nonebot/plugin/__init__.pyi b/nonebot/plugin/__init__.pyi index 02cc6b96..d99e96e1 100644 --- a/nonebot/plugin/__init__.pyi +++ b/nonebot/plugin/__init__.pyi @@ -156,7 +156,7 @@ def on_shell_command(cmd: Union[str, Tuple[str, ...]], def on_regex(pattern: str, flags: Union[int, re.RegexFlag] = 0, - rule: Optional[Rule] = ..., + rule: Optional[Union[Rule, T_RuleChecker]] = ..., *, permission: Optional[Permission] = ..., handlers: Optional[List[T_Handler]] = ..., @@ -409,7 +409,7 @@ class MatcherGroup: pattern: str, flags: Union[int, re.RegexFlag] = 0, *, - rule: Optional[Rule] = ..., + rule: Optional[Union[Rule, T_RuleChecker]] = ..., permission: Optional[Permission] = ..., handlers: Optional[List[T_Handler]] = ..., temp: bool = ...,