From b7e5ce88eaec204070692aa15c50d296c8646030 Mon Sep 17 00:00:00 2001 From: StarHeartHunt Date: Tue, 23 Mar 2021 23:02:37 +0800 Subject: [PATCH 1/2] :memo: Correct params of hook functions --- archive/2.0.0a11/advanced/runtime-hook.md | 8 ++++---- docs/advanced/runtime-hook.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/archive/2.0.0a11/advanced/runtime-hook.md b/archive/2.0.0a11/advanced/runtime-hook.md index b5cc8b6d..9145cd8f 100644 --- a/archive/2.0.0a11/advanced/runtime-hook.md +++ b/archive/2.0.0a11/advanced/runtime-hook.md @@ -15,7 +15,7 @@ from nonebot.exception import IgnoredException @event_preprocessor -async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State): +async def do_something(bot: Bot, event: Event, state: T_State): raise IgnoredException("reason") ``` ::: @@ -26,7 +26,7 @@ async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State) from nonebot.message import event_preprocessor @event_preprocessor -async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State): +async def do_something(bot: Bot, event: Event, state: T_State): pass ``` @@ -36,7 +36,7 @@ async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State) from nonebot.message import event_postprocessor @event_postprocessor -async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State): +async def do_something(bot: Bot, event: Event, state: T_State): pass ``` @@ -55,6 +55,6 @@ async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State) from nonebot.message import run_postprocessor @run_postprocessor -async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State): +async def do_something(matcher: Matcher, exception: Optional[Exception], bot: Bot, event: Event, state: T_State): pass ``` \ No newline at end of file diff --git a/docs/advanced/runtime-hook.md b/docs/advanced/runtime-hook.md index b5cc8b6d..9145cd8f 100644 --- a/docs/advanced/runtime-hook.md +++ b/docs/advanced/runtime-hook.md @@ -15,7 +15,7 @@ from nonebot.exception import IgnoredException @event_preprocessor -async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State): +async def do_something(bot: Bot, event: Event, state: T_State): raise IgnoredException("reason") ``` ::: @@ -26,7 +26,7 @@ async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State) from nonebot.message import event_preprocessor @event_preprocessor -async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State): +async def do_something(bot: Bot, event: Event, state: T_State): pass ``` @@ -36,7 +36,7 @@ async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State) from nonebot.message import event_postprocessor @event_postprocessor -async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State): +async def do_something(bot: Bot, event: Event, state: T_State): pass ``` @@ -55,6 +55,6 @@ async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State) from nonebot.message import run_postprocessor @run_postprocessor -async def do_something(matcher: Matcher, bot: Bot, event: Event, state: T_State): +async def do_something(matcher: Matcher, exception: Optional[Exception], bot: Bot, event: Event, state: T_State): pass ``` \ No newline at end of file From 696ae2da6b543682019b5ae3308f799226119795 Mon Sep 17 00:00:00 2001 From: StarHeartHunt Date: Tue, 23 Mar 2021 15:11:34 +0000 Subject: [PATCH 2/2] :memo: update api docs --- docs/api/plugin.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/api/plugin.md b/docs/api/plugin.md index cc785f1f..59a8fd78 100644 --- a/docs/api/plugin.md +++ b/docs/api/plugin.md @@ -82,15 +82,6 @@ def something_else(): * **说明**: 插件模块对象 -### `matcher` - - -* **类型**: `Set[Type[Matcher]]` - - -* **说明**: 插件内定义的 `Matcher` - - ### `export` @@ -100,6 +91,15 @@ def something_else(): * **说明**: 插件内定义的导出内容 +### _property_ `matcher` + + +* **类型**: `Set[Type[Matcher]]` + + +* **说明**: 插件内定义的 `Matcher` + + ## `on(type='', rule=None, permission=None, *, handlers=None, temp=False, priority=1, block=False, state=None, state_factory=None)`