Merge branch 'dev' into master

This commit is contained in:
Ju4tCode
2021-02-02 12:04:01 +08:00
committed by GitHub
66 changed files with 5633 additions and 203 deletions

View File

@ -50,3 +50,6 @@
* [nonebot.adapters.ding](adapters/ding.html)
* [nonebot.adapters.mirai](adapters/mirai.html)

View File

@ -17,21 +17,25 @@ sidebarDepth: 0
Bot 基类。用于处理上报消息,并提供 API 调用接口。
### _abstract_ `__init__(driver, connection_type, config, self_id, *, websocket=None)`
### `driver`
Driver 对象
### `config`
Config 配置对象
### _abstract_ `__init__(connection_type, self_id, *, websocket=None)`
* **参数**
* `driver: Driver`: Driver 对象
* `connection_type: str`: http 或者 websocket
* `config: Config`: Config 对象
* `self_id: str`: 机器人 ID
@ -39,21 +43,11 @@ Bot 基类。用于处理上报消息,并提供 API 调用接口。
### `driver`
Driver 对象
### `connection_type`
连接类型
### `config`
Config 配置对象
### `self_id`
机器人 ID
@ -69,6 +63,15 @@ Websocket 连接对象
Adapter 类型
### _classmethod_ `register(driver, config)`
* **说明**
register 方法会在 driver.register_adapter 时被调用,用于初始化相关配置
### _abstract async classmethod_ `check_permission(driver, connection_type, headers, body)`

View File

@ -197,6 +197,16 @@ sidebarDepth: 0
@指定手机号人员
### _static_ `atDingtalkIds(*dingtalkIds)`
@指定 id@ 默认会在消息段末尾。
所以你可以在消息中使用 @{senderId} 占位,发送出去之后 @ 就会出现在占位的位置:
``python
message = MessageSegment.text(f"@{event.senderId},你好")
message += MessageSegment.atDingtalkIds(event.senderId)
``
### _static_ `text(text)`
发送 `text` 类型消息
@ -212,6 +222,11 @@ sidebarDepth: 0
"标记 text 文本的 extension 属性,需要与 text 消息段相加。
### _static_ `code(code_language, code)`
"发送 code 消息段
### _static_ `markdown(title, text)`
发送 `markdown` 类型消息

1908
docs/api/adapters/mirai.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ NoneBot 使用 [pydantic](https://pydantic-docs.helpmanual.io/) 以及 [python-d
## _class_ `Env`
基类:`pydantic.env_settings.BaseSettings`
基类:`nonebot.config.BaseConfig`
运行环境配置。大小写不敏感。
@ -211,7 +211,7 @@ X-Signature: sha1=f9ddd4863ace61e64f462d41ca311e3d2c1176e2
```default
SUPER_USERS=["12345789"]
SUPERUSERS=["12345789"]
```

View File

@ -120,7 +120,7 @@ Driver 基类。将后端框架封装,以满足适配器使用。
### _classmethod_ `register_adapter(name, adapter)`
### `register_adapter(name, adapter)`
* **说明**

View File

@ -1225,7 +1225,7 @@ def something_else():
## `load_builtin_plugins()`
## `load_builtin_plugins(name='echo')`
* **说明**

View File

@ -215,7 +215,8 @@ Rule(async_function, run_sync(sync_function))
根据正则表达式进行匹配。
可以通过 `state["_matched"]` 获取正则表达式匹配成功的文本。
可以通过 `state["_matched"]` `state["_matched_groups"]` `state["_matched_dict"]`
获取正则表达式匹配成功的文本。