📝 update api docs

This commit is contained in:
yanyongyu 2021-06-15 10:16:31 +08:00
parent c76dae584e
commit ad2060e651
5 changed files with 65 additions and 53 deletions

View File

@ -63,13 +63,10 @@ Config 配置对象
* **参数**
* `connection_type: str`: http 或者 websocket
* `self_id: str`: 机器人 ID
* `websocket: Optional[WebSocket]`: Websocket 连接对象
* `request: HTTPConnection`: request 连接对象
@ -112,30 +109,17 @@ Adapter 类型
* `driver: Driver`: Driver 对象
* `connection_type: str`: 连接类型
* `headers: dict`: 请求头
* `body: Optional[bytes]`: 请求数据WebSocket 连接该部分为 None
* `request: HTTPConnection`: request 请求详情
* **返回**
* `str`: 连接唯一标识符,`None` 代表连接不合法
* `Optional[str]`: 连接唯一标识符,`None` 代表连接不合法
* `HTTPResponse`: HTTP 上报响应
* **异常**
* `RequestDenied`: 请求非法
* `Optional[HTTPResponse]`: HTTP 上报响应
@ -224,9 +208,59 @@ await bot.send_msg(message="hello world")
### _classmethod_ `on_calling_api(func)`
* **说明**
调用 api 预处理。
* **参数**
* `bot: Bot`: 当前 bot 对象
* `api: str`: 调用的 api 名称
* `data: Dict[str, Any]`: api 调用的参数字典
### _classmethod_ `on_called_api(func)`
* **说明**
调用 api 后处理。
* **参数**
* `bot: Bot`: 当前 bot 对象
* `exception: Optional[Exception]`: 调用 api 时发生的错误
* `api: str`: 调用的 api 名称
* `data: Dict[str, Any]`: api 调用的参数字典
* `result: Any`: api 调用的返回
## _class_ `MessageSegment`
基类:`abc.ABC`, `Mapping`
基类:`Mapping`, `abc.ABC`, `Generic`[`nonebot.adapters._base.T_Message`]
消息段基类
@ -298,15 +332,6 @@ await bot.send_msg(message="hello world")
### `reduce()`
* **说明**
缩减消息数组,即按 MessageSegment 的实现拼接相邻消息段
### `extract_plain_text()`

View File

@ -307,11 +307,14 @@ CQHTTP 协议 Bot 适配。继承属性参考 [BaseBot](./#class-basebot) 。
## _class_ `MessageSegment`
基类:`abc.ABC`, `Mapping`
基类:[`nonebot.adapters._base.MessageSegment`](README.md#nonebot.adapters._base.MessageSegment)[`Message`]
CQHTTP 协议 MessageSegment 适配。具体方法参考协议消息段类型或源码。
### _classmethod_ `get_message_class()`
### `is_text()`
@ -412,6 +415,9 @@ CQHTTP 协议 MessageSegment 适配。具体方法参考协议消息段类型或
CQHTTP 协议 Message 适配。
### _classmethod_ `get_segment_class()`
### `extract_plain_text()`
# NoneBot.adapters.cqhttp.permission 模块

View File

@ -208,7 +208,7 @@ sidebarDepth: 0
## _class_ `MessageSegment`
基类:`abc.ABC`, `Mapping`
基类:`Mapping`, `abc.ABC`, `Generic`[`nonebot.adapters._base.T_Message`]
钉钉 协议 MessageSegment 适配。具体方法参考协议消息段类型或源码。

View File

@ -727,7 +727,7 @@ mirai-api-http 正向 Websocket 协议 Bot 适配。
## _class_ `MessageSegment`
基类:`abc.ABC`, `Mapping`
基类:`Mapping`, `abc.ABC`, `Generic`[`nonebot.adapters._base.T_Message`]
Mirai-API-HTTP 协议 MessageSegment 适配。具体方法参考 [mirai-api-http 消息类型](https://github.com/project-mirai/mirai-api-http/blob/master/docs/MessageType.md)
@ -975,15 +975,6 @@ Mirai 协议 Message 适配
由于Mirai协议的Message实现较为特殊, 故使用MessageChain命名
### `reduce()`
* **说明**
忽略为空的消息段, 合并相邻的纯文本消息段
### `export()`
导出为可以被正常json序列化的数组

View File

@ -258,16 +258,6 @@ Reverse Driver 基类。将后端框架封装,以满足适配器使用。
驱动 ASGI 对象
### _abstract async_ `_handle_http(*args, **kwargs)`
用于处理 HTTP 类型请求的函数
### _abstract async_ `_handle_ws_reverse(*args, **kwargs)`
用于处理 WebSocket 类型请求的函数
## _class_ `HTTPConnection`
基类:`abc.ABC`
@ -425,4 +415,4 @@ Always `websocket`
### _abstract async_ `send_bytes(data)`
发送一条 WebSocket text 信息
发送一条 WebSocket binary 信息