📝 update doc

This commit is contained in:
yanyongyu 2021-04-01 20:27:27 +08:00
parent f0a6ff4627
commit e03e3f6130
50 changed files with 123 additions and 5 deletions

View File

@ -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` 进行 `事件处理` 的函数。

View File

@ -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)`

View File

@ -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`

View File

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -1,5 +1,5 @@
[
"2.0.0a12",
"2.0.0a13",
"2.0.0a10",
"2.0.0a8.post2",
"2.0.0a7"

View File

@ -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` 进行 `事件处理` 的函数。

View File

@ -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)`

View File

@ -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`