diff --git a/archive/2.0.0a12/README.md b/archive/2.0.0a13/README.md similarity index 100% rename from archive/2.0.0a12/README.md rename to archive/2.0.0a13/README.md diff --git a/archive/2.0.0a12/advanced/README.md b/archive/2.0.0a13/advanced/README.md similarity index 100% rename from archive/2.0.0a12/advanced/README.md rename to archive/2.0.0a13/advanced/README.md diff --git a/archive/2.0.0a12/advanced/export-and-require.md b/archive/2.0.0a13/advanced/export-and-require.md similarity index 100% rename from archive/2.0.0a12/advanced/export-and-require.md rename to archive/2.0.0a13/advanced/export-and-require.md diff --git a/archive/2.0.0a12/advanced/overloaded-handlers.md b/archive/2.0.0a13/advanced/overloaded-handlers.md similarity index 100% rename from archive/2.0.0a12/advanced/overloaded-handlers.md rename to archive/2.0.0a13/advanced/overloaded-handlers.md diff --git a/archive/2.0.0a12/advanced/permission.md b/archive/2.0.0a13/advanced/permission.md similarity index 100% rename from archive/2.0.0a12/advanced/permission.md rename to archive/2.0.0a13/advanced/permission.md diff --git a/archive/2.0.0a12/advanced/publish-plugin.md b/archive/2.0.0a13/advanced/publish-plugin.md similarity index 100% rename from archive/2.0.0a12/advanced/publish-plugin.md rename to archive/2.0.0a13/advanced/publish-plugin.md diff --git a/archive/2.0.0a12/advanced/runtime-hook.md b/archive/2.0.0a13/advanced/runtime-hook.md similarity index 91% rename from archive/2.0.0a12/advanced/runtime-hook.md rename to archive/2.0.0a13/advanced/runtime-hook.md index f7e26be6..5e98c22a 100644 --- a/archive/2.0.0a12/advanced/runtime-hook.md +++ b/archive/2.0.0a13/advanced/runtime-hook.md @@ -19,7 +19,7 @@ from nonebot import get_driver driver=get_driver() ``` -共分为五种函数: +共分为六种函数: ### 启动准备 @@ -73,6 +73,18 @@ async def handle_api_call(bot: Bot, api: str, data: Dict[str, Any]): pass ``` +### bot api 调用后钩子 + +这个钩子函数会在 `Bot` 调用 API 后运行。 + +```python +from nonebot.adapters import Bot + +@Bot.on_called_api +async def handle_api_result(bot: Bot, exception: Optional[Exception], api: str, data: Dict[str, Any], result: Any): + pass +``` + ## 事件处理钩子 这些钩子函数指的是影响 `nonebot2` 进行 `事件处理` 的函数。 diff --git a/archive/2.0.0a12/advanced/scheduler.md b/archive/2.0.0a13/advanced/scheduler.md similarity index 100% rename from archive/2.0.0a12/advanced/scheduler.md rename to archive/2.0.0a13/advanced/scheduler.md diff --git a/archive/2.0.0a12/api/README.md b/archive/2.0.0a13/api/README.md similarity index 100% rename from archive/2.0.0a12/api/README.md rename to archive/2.0.0a13/api/README.md diff --git a/archive/2.0.0a12/api/adapters/README.md b/archive/2.0.0a13/api/adapters/README.md similarity index 97% rename from archive/2.0.0a12/api/adapters/README.md rename to archive/2.0.0a13/api/adapters/README.md index bd4aab2a..fa3f597e 100644 --- a/archive/2.0.0a12/api/adapters/README.md +++ b/archive/2.0.0a13/api/adapters/README.md @@ -27,7 +27,7 @@ Driver 对象 Config 配置对象 -### `_call_api_hook` +### `_calling_api_hook` * **类型** @@ -42,6 +42,21 @@ Config 配置对象 +### `_called_api_hook` + + +* **类型** + + `Set[T_CalledAPIHook]` + + + +* **说明** + + call_api 后执行的函数 + + + ### _abstract_ `__init__(connection_type, self_id, *, websocket=None)` diff --git a/archive/2.0.0a12/api/adapters/cqhttp.md b/archive/2.0.0a13/api/adapters/cqhttp.md similarity index 100% rename from archive/2.0.0a12/api/adapters/cqhttp.md rename to archive/2.0.0a13/api/adapters/cqhttp.md diff --git a/archive/2.0.0a12/api/adapters/ding.md b/archive/2.0.0a13/api/adapters/ding.md similarity index 100% rename from archive/2.0.0a12/api/adapters/ding.md rename to archive/2.0.0a13/api/adapters/ding.md diff --git a/archive/2.0.0a12/api/adapters/mirai.md b/archive/2.0.0a13/api/adapters/mirai.md similarity index 100% rename from archive/2.0.0a12/api/adapters/mirai.md rename to archive/2.0.0a13/api/adapters/mirai.md diff --git a/archive/2.0.0a12/api/config.md b/archive/2.0.0a13/api/config.md similarity index 100% rename from archive/2.0.0a12/api/config.md rename to archive/2.0.0a13/api/config.md diff --git a/archive/2.0.0a12/api/drivers/README.md b/archive/2.0.0a13/api/drivers/README.md similarity index 100% rename from archive/2.0.0a12/api/drivers/README.md rename to archive/2.0.0a13/api/drivers/README.md diff --git a/archive/2.0.0a12/api/drivers/fastapi.md b/archive/2.0.0a13/api/drivers/fastapi.md similarity index 100% rename from archive/2.0.0a12/api/drivers/fastapi.md rename to archive/2.0.0a13/api/drivers/fastapi.md diff --git a/archive/2.0.0a12/api/drivers/quart.md b/archive/2.0.0a13/api/drivers/quart.md similarity index 100% rename from archive/2.0.0a12/api/drivers/quart.md rename to archive/2.0.0a13/api/drivers/quart.md diff --git a/archive/2.0.0a12/api/exception.md b/archive/2.0.0a13/api/exception.md similarity index 100% rename from archive/2.0.0a12/api/exception.md rename to archive/2.0.0a13/api/exception.md diff --git a/archive/2.0.0a12/api/handler.md b/archive/2.0.0a13/api/handler.md similarity index 100% rename from archive/2.0.0a12/api/handler.md rename to archive/2.0.0a13/api/handler.md diff --git a/archive/2.0.0a12/api/log.md b/archive/2.0.0a13/api/log.md similarity index 100% rename from archive/2.0.0a12/api/log.md rename to archive/2.0.0a13/api/log.md diff --git a/archive/2.0.0a12/api/matcher.md b/archive/2.0.0a13/api/matcher.md similarity index 100% rename from archive/2.0.0a12/api/matcher.md rename to archive/2.0.0a13/api/matcher.md diff --git a/archive/2.0.0a12/api/message.md b/archive/2.0.0a13/api/message.md similarity index 100% rename from archive/2.0.0a12/api/message.md rename to archive/2.0.0a13/api/message.md diff --git a/archive/2.0.0a12/api/nonebot.md b/archive/2.0.0a13/api/nonebot.md similarity index 100% rename from archive/2.0.0a12/api/nonebot.md rename to archive/2.0.0a13/api/nonebot.md diff --git a/archive/2.0.0a12/api/permission.md b/archive/2.0.0a13/api/permission.md similarity index 100% rename from archive/2.0.0a12/api/permission.md rename to archive/2.0.0a13/api/permission.md diff --git a/archive/2.0.0a12/api/plugin.md b/archive/2.0.0a13/api/plugin.md similarity index 100% rename from archive/2.0.0a12/api/plugin.md rename to archive/2.0.0a13/api/plugin.md diff --git a/archive/2.0.0a12/api/rule.md b/archive/2.0.0a13/api/rule.md similarity index 100% rename from archive/2.0.0a12/api/rule.md rename to archive/2.0.0a13/api/rule.md diff --git a/archive/2.0.0a12/api/typing.md b/archive/2.0.0a13/api/typing.md similarity index 89% rename from archive/2.0.0a12/api/typing.md rename to archive/2.0.0a13/api/typing.md index c3ec95bf..756ef946 100644 --- a/archive/2.0.0a12/api/typing.md +++ b/archive/2.0.0a13/api/typing.md @@ -78,6 +78,38 @@ sidebarDepth: 0 +## `T_CallingAPIHook` + + +* **类型** + + `Callable[[Bot, str, Dict[str, Any]], Awaitable[None]]` + + + +* **说明** + + `bot.call_api` 时执行的函数 + + + + +## `T_CalledAPIHook` + + +* **类型** + + `Callable[[Bot, Optional[Exception], str, Dict[str, Any], Any], Awaitable[None]]` + + + +* **说明** + + `bot.call_api` 后执行的函数,参数分别为 bot, exception, api, data, result + + + + ## `T_EventPreProcessor` diff --git a/archive/2.0.0a12/api/utils.md b/archive/2.0.0a13/api/utils.md similarity index 100% rename from archive/2.0.0a12/api/utils.md rename to archive/2.0.0a13/api/utils.md diff --git a/archive/2.0.0a12/guide/README.md b/archive/2.0.0a13/guide/README.md similarity index 100% rename from archive/2.0.0a12/guide/README.md rename to archive/2.0.0a13/guide/README.md diff --git a/archive/2.0.0a12/guide/basic-configuration.md b/archive/2.0.0a13/guide/basic-configuration.md similarity index 100% rename from archive/2.0.0a12/guide/basic-configuration.md rename to archive/2.0.0a13/guide/basic-configuration.md diff --git a/archive/2.0.0a12/guide/cqhttp-guide.md b/archive/2.0.0a13/guide/cqhttp-guide.md similarity index 100% rename from archive/2.0.0a12/guide/cqhttp-guide.md rename to archive/2.0.0a13/guide/cqhttp-guide.md diff --git a/archive/2.0.0a12/guide/creating-a-handler.md b/archive/2.0.0a13/guide/creating-a-handler.md similarity index 100% rename from archive/2.0.0a12/guide/creating-a-handler.md rename to archive/2.0.0a13/guide/creating-a-handler.md diff --git a/archive/2.0.0a12/guide/creating-a-matcher.md b/archive/2.0.0a13/guide/creating-a-matcher.md similarity index 100% rename from archive/2.0.0a12/guide/creating-a-matcher.md rename to archive/2.0.0a13/guide/creating-a-matcher.md diff --git a/archive/2.0.0a12/guide/creating-a-plugin.md b/archive/2.0.0a13/guide/creating-a-plugin.md similarity index 100% rename from archive/2.0.0a12/guide/creating-a-plugin.md rename to archive/2.0.0a13/guide/creating-a-plugin.md diff --git a/archive/2.0.0a12/guide/creating-a-project.md b/archive/2.0.0a13/guide/creating-a-project.md similarity index 100% rename from archive/2.0.0a12/guide/creating-a-project.md rename to archive/2.0.0a13/guide/creating-a-project.md diff --git a/archive/2.0.0a12/guide/ding-guide.md b/archive/2.0.0a13/guide/ding-guide.md similarity index 100% rename from archive/2.0.0a12/guide/ding-guide.md rename to archive/2.0.0a13/guide/ding-guide.md diff --git a/archive/2.0.0a12/guide/end-or-start.md b/archive/2.0.0a13/guide/end-or-start.md similarity index 100% rename from archive/2.0.0a12/guide/end-or-start.md rename to archive/2.0.0a13/guide/end-or-start.md diff --git a/archive/2.0.0a12/guide/getting-started.md b/archive/2.0.0a13/guide/getting-started.md similarity index 100% rename from archive/2.0.0a12/guide/getting-started.md rename to archive/2.0.0a13/guide/getting-started.md diff --git a/archive/2.0.0a12/guide/images/Handle-Event.png b/archive/2.0.0a13/guide/images/Handle-Event.png similarity index 100% rename from archive/2.0.0a12/guide/images/Handle-Event.png rename to archive/2.0.0a13/guide/images/Handle-Event.png diff --git a/archive/2.0.0a12/guide/images/ding/jiaqian.png b/archive/2.0.0a13/guide/images/ding/jiaqian.png similarity index 100% rename from archive/2.0.0a12/guide/images/ding/jiaqian.png rename to archive/2.0.0a13/guide/images/ding/jiaqian.png diff --git a/archive/2.0.0a12/guide/images/ding/test_webhook.png b/archive/2.0.0a13/guide/images/ding/test_webhook.png similarity index 100% rename from archive/2.0.0a12/guide/images/ding/test_webhook.png rename to archive/2.0.0a13/guide/images/ding/test_webhook.png diff --git a/archive/2.0.0a12/guide/images/ding/webhook.png b/archive/2.0.0a13/guide/images/ding/webhook.png similarity index 100% rename from archive/2.0.0a12/guide/images/ding/webhook.png rename to archive/2.0.0a13/guide/images/ding/webhook.png diff --git a/archive/2.0.0a12/guide/installation.md b/archive/2.0.0a13/guide/installation.md similarity index 100% rename from archive/2.0.0a12/guide/installation.md rename to archive/2.0.0a13/guide/installation.md diff --git a/archive/2.0.0a12/guide/loading-a-plugin.md b/archive/2.0.0a13/guide/loading-a-plugin.md similarity index 100% rename from archive/2.0.0a12/guide/loading-a-plugin.md rename to archive/2.0.0a13/guide/loading-a-plugin.md diff --git a/archive/2.0.0a12/guide/mirai-guide.md b/archive/2.0.0a13/guide/mirai-guide.md similarity index 100% rename from archive/2.0.0a12/guide/mirai-guide.md rename to archive/2.0.0a13/guide/mirai-guide.md diff --git a/archive/2.0.0a12/sidebar.config.json b/archive/2.0.0a13/sidebar.config.json similarity index 100% rename from archive/2.0.0a12/sidebar.config.json rename to archive/2.0.0a13/sidebar.config.json diff --git a/docs/.vuepress/versions.json b/docs/.vuepress/versions.json index b159ca74..81fb149d 100644 --- a/docs/.vuepress/versions.json +++ b/docs/.vuepress/versions.json @@ -1,5 +1,5 @@ [ - "2.0.0a12", + "2.0.0a13", "2.0.0a10", "2.0.0a8.post2", "2.0.0a7" diff --git a/docs/advanced/runtime-hook.md b/docs/advanced/runtime-hook.md index f7e26be6..5e98c22a 100644 --- a/docs/advanced/runtime-hook.md +++ b/docs/advanced/runtime-hook.md @@ -19,7 +19,7 @@ from nonebot import get_driver driver=get_driver() ``` -共分为五种函数: +共分为六种函数: ### 启动准备 @@ -73,6 +73,18 @@ async def handle_api_call(bot: Bot, api: str, data: Dict[str, Any]): pass ``` +### bot api 调用后钩子 + +这个钩子函数会在 `Bot` 调用 API 后运行。 + +```python +from nonebot.adapters import Bot + +@Bot.on_called_api +async def handle_api_result(bot: Bot, exception: Optional[Exception], api: str, data: Dict[str, Any], result: Any): + pass +``` + ## 事件处理钩子 这些钩子函数指的是影响 `nonebot2` 进行 `事件处理` 的函数。 diff --git a/docs/api/adapters/README.md b/docs/api/adapters/README.md index bd4aab2a..fa3f597e 100644 --- a/docs/api/adapters/README.md +++ b/docs/api/adapters/README.md @@ -27,7 +27,7 @@ Driver 对象 Config 配置对象 -### `_call_api_hook` +### `_calling_api_hook` * **类型** @@ -42,6 +42,21 @@ Config 配置对象 +### `_called_api_hook` + + +* **类型** + + `Set[T_CalledAPIHook]` + + + +* **说明** + + call_api 后执行的函数 + + + ### _abstract_ `__init__(connection_type, self_id, *, websocket=None)` diff --git a/docs/api/typing.md b/docs/api/typing.md index c3ec95bf..756ef946 100644 --- a/docs/api/typing.md +++ b/docs/api/typing.md @@ -78,6 +78,38 @@ sidebarDepth: 0 +## `T_CallingAPIHook` + + +* **类型** + + `Callable[[Bot, str, Dict[str, Any]], Awaitable[None]]` + + + +* **说明** + + `bot.call_api` 时执行的函数 + + + + +## `T_CalledAPIHook` + + +* **类型** + + `Callable[[Bot, Optional[Exception], str, Dict[str, Any], Any], Awaitable[None]]` + + + +* **说明** + + `bot.call_api` 后执行的函数,参数分别为 bot, exception, api, data, result + + + + ## `T_EventPreProcessor`