mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 09:05:04 +08:00
commit
30132e21e8
@ -128,7 +128,7 @@ def check(arg1, args2):
|
||||
async def _checker(bot: Bot, event: Event, state: T_State) -> bool:
|
||||
return bool(arg1 + arg2)
|
||||
|
||||
return Rule(_check)
|
||||
return Rule(_checker)
|
||||
```
|
||||
|
||||
`Rule` 和 `RuleChecker` 之间可以使用 `与 &` 互相组合:
|
||||
|
@ -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)`
|
||||
|
||||
|
||||
|
@ -120,7 +120,7 @@ Driver 基类。将后端框架封装,以满足适配器使用。
|
||||
|
||||
|
||||
|
||||
### _classmethod_ `register_adapter(name, adapter)`
|
||||
### `register_adapter(name, adapter)`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
@ -128,7 +128,7 @@ def check(arg1, args2):
|
||||
async def _checker(bot: Bot, event: Event, state: T_State) -> bool:
|
||||
return bool(arg1 + arg2)
|
||||
|
||||
return Rule(_check)
|
||||
return Rule(_checker)
|
||||
```
|
||||
|
||||
`Rule` 和 `RuleChecker` 之间可以使用 `与 &` 互相组合:
|
||||
|
Loading…
Reference in New Issue
Block a user