mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-27 16:21:28 +00:00
📝 update doc
This commit is contained in:
@ -174,6 +174,98 @@ await bot.send_msg(message="hello world")
|
||||
|
||||
|
||||
|
||||
## _class_ `MessageSegment`
|
||||
|
||||
基类:`abc.ABC`
|
||||
|
||||
消息段基类
|
||||
|
||||
|
||||
### `type`
|
||||
|
||||
|
||||
* 类型: `str`
|
||||
|
||||
|
||||
* 说明: 消息段类型
|
||||
|
||||
|
||||
### `data`
|
||||
|
||||
|
||||
* 类型: `Dict[str, Union[str, list]]`
|
||||
|
||||
|
||||
* 说明: 消息段数据
|
||||
|
||||
|
||||
## _class_ `Message`
|
||||
|
||||
基类:`list`, `abc.ABC`
|
||||
|
||||
消息数组
|
||||
|
||||
|
||||
### `__init__(message=None, *args, **kwargs)`
|
||||
|
||||
|
||||
* **参数**
|
||||
|
||||
|
||||
* `message: Union[str, list, dict, MessageSegment, Message, Any]`: 消息内容
|
||||
|
||||
|
||||
|
||||
### `append(obj)`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
添加一个消息段到消息数组末尾
|
||||
|
||||
|
||||
|
||||
* **参数**
|
||||
|
||||
|
||||
* `obj: Union[str, MessageSegment]`: 要添加的消息段
|
||||
|
||||
|
||||
|
||||
### `extend(obj)`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
拼接一个消息数组或多个消息段到消息数组末尾
|
||||
|
||||
|
||||
|
||||
* **参数**
|
||||
|
||||
|
||||
* `obj: Union[Message, Iterable[MessageSegment]]`: 要添加的消息数组
|
||||
|
||||
|
||||
|
||||
### `reduce()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
缩减消息数组,即按 MessageSegment 的实现拼接相邻消息段
|
||||
|
||||
|
||||
|
||||
### `extract_plain_text()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
提取消息内纯文本消息
|
||||
|
||||
|
||||
|
||||
## _class_ `Event`
|
||||
|
||||
基类:`abc.ABC`, `pydantic.main.BaseModel`
|
||||
@ -329,95 +421,3 @@ Event 基类。提供获取关键信息的方法,其余信息可直接获取
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
|
||||
|
||||
## _class_ `MessageSegment`
|
||||
|
||||
基类:`abc.ABC`
|
||||
|
||||
消息段基类
|
||||
|
||||
|
||||
### `type`
|
||||
|
||||
|
||||
* 类型: `str`
|
||||
|
||||
|
||||
* 说明: 消息段类型
|
||||
|
||||
|
||||
### `data`
|
||||
|
||||
|
||||
* 类型: `Dict[str, Union[str, list]]`
|
||||
|
||||
|
||||
* 说明: 消息段数据
|
||||
|
||||
|
||||
## _class_ `Message`
|
||||
|
||||
基类:`list`, `abc.ABC`
|
||||
|
||||
消息数组
|
||||
|
||||
|
||||
### `__init__(message=None, *args, **kwargs)`
|
||||
|
||||
|
||||
* **参数**
|
||||
|
||||
|
||||
* `message: Union[str, list, dict, MessageSegment, Message, Any]`: 消息内容
|
||||
|
||||
|
||||
|
||||
### `append(obj)`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
添加一个消息段到消息数组末尾
|
||||
|
||||
|
||||
|
||||
* **参数**
|
||||
|
||||
|
||||
* `obj: Union[str, MessageSegment]`: 要添加的消息段
|
||||
|
||||
|
||||
|
||||
### `extend(obj)`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
拼接一个消息数组或多个消息段到消息数组末尾
|
||||
|
||||
|
||||
|
||||
* **参数**
|
||||
|
||||
|
||||
* `obj: Union[Message, Iterable[MessageSegment]]`: 要添加的消息数组
|
||||
|
||||
|
||||
|
||||
### `reduce()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
缩减消息数组,即按 MessageSegment 的实现拼接相邻消息段
|
||||
|
||||
|
||||
|
||||
### `extract_plain_text()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
提取消息内纯文本消息
|
||||
|
@ -5,6 +5,12 @@ sidebarDepth: 0
|
||||
|
||||
# NoneBot.adapters.cqhttp 模块
|
||||
|
||||
## CQHTTP (OneBot) v11 协议适配
|
||||
|
||||
协议详情请看: [CQHTTP](https://github.com/howmanybots/onebot/blob/master/README.md) | [OneBot](https://github.com/howmanybots/onebot/blob/master/README.md)
|
||||
|
||||
# NoneBot.adapters.cqhttp.utils 模块
|
||||
|
||||
|
||||
## `escape(s, *, escape_comma=True)`
|
||||
|
||||
@ -40,10 +46,7 @@ sidebarDepth: 0
|
||||
* `s: str`: 需要转义的字符串
|
||||
|
||||
|
||||
|
||||
## _exception_ `CQHTTPAdapterException`
|
||||
|
||||
基类:[`nonebot.exception.AdapterException`](../exception.md#nonebot.exception.AdapterException)
|
||||
# NoneBot.adapters.cqhttp.exception 模块
|
||||
|
||||
|
||||
## _exception_ `ActionFailed`
|
||||
@ -81,10 +84,7 @@ sidebarDepth: 0
|
||||
* `retcode: Optional[int]`: 错误码
|
||||
|
||||
|
||||
|
||||
## _exception_ `ApiNotAvailable`
|
||||
|
||||
基类:[`nonebot.exception.ApiNotAvailable`](../exception.md#nonebot.exception.ApiNotAvailable), `nonebot.adapters.cqhttp.exception.CQHTTPAdapterException`
|
||||
# NoneBot.adapters.cqhttp.bot 模块
|
||||
|
||||
|
||||
## _async_ `_check_reply(bot, event)`
|
||||
@ -285,6 +285,8 @@ CQHTTP 协议 Bot 适配。继承属性参考 [BaseBot](./#class-basebot) 。
|
||||
* `ActionFailed`: API 调用失败
|
||||
|
||||
|
||||
# NoneBot.adapters.cqhttp.message 模块
|
||||
|
||||
|
||||
## _class_ `MessageSegment`
|
||||
|
||||
@ -299,140 +301,68 @@ CQHTTP 协议 MessageSegment 适配。具体方法参考协议消息段类型或
|
||||
|
||||
CQHTTP 协议 Message 适配。
|
||||
|
||||
# NoneBot.adapters.cqhttp.permission 模块
|
||||
|
||||
|
||||
## `PRIVATE`
|
||||
|
||||
|
||||
* **说明**: 匹配任意私聊消息类型事件
|
||||
|
||||
|
||||
## `PRIVATE_FRIEND`
|
||||
|
||||
|
||||
* **说明**: 匹配任意好友私聊消息类型事件
|
||||
|
||||
|
||||
## `PRIVATE_GROUP`
|
||||
|
||||
|
||||
* **说明**: 匹配任意群临时私聊消息类型事件
|
||||
|
||||
|
||||
## `PRIVATE_OTHER`
|
||||
|
||||
|
||||
* **说明**: 匹配任意其他私聊消息类型事件
|
||||
|
||||
|
||||
## `GROUP`
|
||||
|
||||
|
||||
* **说明**: 匹配任意群聊消息类型事件
|
||||
|
||||
|
||||
## `GROUP_MEMBER`
|
||||
|
||||
|
||||
* **说明**: 匹配任意群员群聊消息类型事件
|
||||
|
||||
:::warning 警告
|
||||
该权限通过 event.sender 进行判断且不包含管理员以及群主!
|
||||
:::
|
||||
|
||||
|
||||
## `GROUP_ADMIN`
|
||||
|
||||
|
||||
* **说明**: 匹配任意群管理员群聊消息类型事件
|
||||
|
||||
|
||||
## `GROUP_OWNER`
|
||||
|
||||
|
||||
* **说明**: 匹配任意群主群聊消息类型事件
|
||||
|
||||
# NoneBot.adapters.cqhttp.event 模块
|
||||
|
||||
|
||||
## _class_ `Event`
|
||||
|
||||
基类:[`nonebot.adapters.Event`](README.md#nonebot.adapters.Event)
|
||||
|
||||
CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https://github.com/howmanybots/onebot/blob/master/README.md)
|
||||
|
||||
|
||||
### `get_type()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件类型的方法,类型通常为 NoneBot 内置的四种类型。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `Literal["message", "notice", "request", "meta_event"]`
|
||||
|
||||
|
||||
|
||||
### `get_event_name()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件名称的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_event_description()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件描述的方法,通常为事件具体内容。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_message()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件消息内容的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `Message`
|
||||
|
||||
|
||||
|
||||
### `get_plaintext()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取消息纯文本的方法,通常不需要修改,默认通过 `get_message().extract_plain_text` 获取。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_user_id()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件主体 id 的方法,通常是用户 id 。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_session_id()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取会话 id 的方法,用于判断当前事件属于哪一个会话,通常是用户 id、群组 id 组合。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
CQHTTP 协议事件,字段与 CQHTTP 一致。各事件字段参考 [CQHTTP 文档](https://github.com/howmanybots/onebot/blob/master/README.md)
|
||||
|
||||
|
||||
## _class_ `MessageEvent`
|
||||
@ -472,102 +402,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
|
||||
|
||||
|
||||
### `get_event_name()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件名称的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_message()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件消息内容的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `Message`
|
||||
|
||||
|
||||
|
||||
### `get_plaintext()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取消息纯文本的方法,通常不需要修改,默认通过 `get_message().extract_plain_text` 获取。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_user_id()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件主体 id 的方法,通常是用户 id 。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_session_id()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取会话 id 的方法,用于判断当前事件属于哪一个会话,通常是用户 id、群组 id 组合。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
|
||||
|
||||
## _class_ `PrivateMessageEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.MessageEvent`
|
||||
@ -575,22 +409,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
私聊消息
|
||||
|
||||
|
||||
### `get_event_description()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件描述的方法,通常为事件具体内容。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
## _class_ `GroupMessageEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.MessageEvent`
|
||||
@ -598,22 +416,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
群消息
|
||||
|
||||
|
||||
### `get_event_description()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件描述的方法,通常为事件具体内容。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
## _class_ `NoticeEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.Event`
|
||||
@ -621,22 +423,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
通知事件
|
||||
|
||||
|
||||
### `get_event_name()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件名称的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
## _class_ `GroupUploadNoticeEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.NoticeEvent`
|
||||
@ -651,22 +437,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
群管理员变动
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
|
||||
|
||||
## _class_ `GroupDecreaseNoticeEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.NoticeEvent`
|
||||
@ -674,22 +444,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
群成员减少事件
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
|
||||
|
||||
## _class_ `GroupIncreaseNoticeEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.NoticeEvent`
|
||||
@ -697,22 +451,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
群成员增加事件
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
|
||||
|
||||
## _class_ `GroupBanNoticeEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.NoticeEvent`
|
||||
@ -720,22 +458,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
群禁言事件
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
|
||||
|
||||
## _class_ `FriendAddNoticeEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.NoticeEvent`
|
||||
@ -750,22 +472,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
群消息撤回事件
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
|
||||
|
||||
## _class_ `FriendRecallNoticeEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.NoticeEvent`
|
||||
@ -787,22 +493,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
戳一戳提醒事件
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
|
||||
|
||||
## _class_ `LuckyKingNotifyEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.NotifyEvent`
|
||||
@ -810,22 +500,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
群红包运气王提醒事件
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
|
||||
|
||||
## _class_ `HonorNotifyEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.NotifyEvent`
|
||||
@ -833,22 +507,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
群荣誉变更提醒事件
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
|
||||
|
||||
## _class_ `RequestEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.Event`
|
||||
@ -856,22 +514,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
请求事件
|
||||
|
||||
|
||||
### `get_event_name()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件名称的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
## _class_ `FriendRequestEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.RequestEvent`
|
||||
@ -893,45 +535,6 @@ CQHTTP 协议事件。各事件字段未列出部分参考 [CQHTTP 文档](https
|
||||
元事件
|
||||
|
||||
|
||||
### `get_event_name()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件名称的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_log_string()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件日志信息的方法,通常你不需要修改这个方法,只有当希望 NoneBot 隐藏该事件日志时,可以抛出 `NoLogException` 异常。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
* **异常**
|
||||
|
||||
|
||||
* `NoLogException`
|
||||
|
||||
|
||||
|
||||
## _class_ `LifecycleMetaEvent`
|
||||
|
||||
基类:`nonebot.adapters.cqhttp.event.MetaEvent`
|
||||
|
@ -5,6 +5,12 @@ sidebarDepth: 0
|
||||
|
||||
# NoneBot.adapters.ding 模块
|
||||
|
||||
## 钉钉群机器人 协议适配
|
||||
|
||||
协议详情请看: [钉钉文档](https://ding-doc.dingtalk.com/document#/org-dev-guide/elzz1p)
|
||||
|
||||
# NoneBot.adapters.ding.exception 模块
|
||||
|
||||
|
||||
## _exception_ `DingAdapterException`
|
||||
|
||||
@ -38,11 +44,6 @@ sidebarDepth: 0
|
||||
|
||||
|
||||
|
||||
## _exception_ `ApiNotAvailable`
|
||||
|
||||
基类:[`nonebot.exception.ApiNotAvailable`](../exception.md#nonebot.exception.ApiNotAvailable), `nonebot.adapters.ding.exception.DingAdapterException`
|
||||
|
||||
|
||||
## _exception_ `NetworkError`
|
||||
|
||||
基类:[`nonebot.exception.NetworkError`](../exception.md#nonebot.exception.NetworkError), `nonebot.adapters.ding.exception.DingAdapterException`
|
||||
@ -71,6 +72,8 @@ sidebarDepth: 0
|
||||
发消息的 session 已经过期。
|
||||
|
||||
|
||||
# NoneBot.adapters.ding.bot 模块
|
||||
|
||||
|
||||
## _class_ `Bot`
|
||||
|
||||
@ -94,22 +97,6 @@ sidebarDepth: 0
|
||||
|
||||
|
||||
|
||||
### _async_ `handle_message(message)`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
处理上报消息的函数,转换为 `Event` 事件后调用 `nonebot.message.handle_event` 进一步处理事件。
|
||||
|
||||
|
||||
|
||||
* **参数**
|
||||
|
||||
|
||||
* `message: dict`: 收到的上报消息
|
||||
|
||||
|
||||
|
||||
### _async_ `call_api(api, event=None, **data)`
|
||||
|
||||
|
||||
@ -190,295 +177,7 @@ sidebarDepth: 0
|
||||
* `ActionFailed`: API 调用失败
|
||||
|
||||
|
||||
|
||||
## _class_ `Event`
|
||||
|
||||
基类:[`nonebot.adapters.Event`](README.md#nonebot.adapters.Event)
|
||||
|
||||
钉钉 协议 Event 适配。各事件字段参考 [钉钉文档](https://ding-doc.dingtalk.com/document#/org-dev-guide/elzz1p)
|
||||
|
||||
|
||||
### `get_type()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件类型的方法,类型通常为 NoneBot 内置的四种类型。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `Literal["message", "notice", "request", "meta_event"]`
|
||||
|
||||
|
||||
|
||||
### `get_event_name()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件名称的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_event_description()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件描述的方法,通常为事件具体内容。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_message()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件消息内容的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `Message`
|
||||
|
||||
|
||||
|
||||
### `get_plaintext()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取消息纯文本的方法,通常不需要修改,默认通过 `get_message().extract_plain_text` 获取。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_user_id()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件主体 id 的方法,通常是用户 id 。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_session_id()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取会话 id 的方法,用于判断当前事件属于哪一个会话,通常是用户 id、群组 id 组合。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
|
||||
|
||||
## _class_ `ConversationType`
|
||||
|
||||
基类:`str`, `enum.Enum`
|
||||
|
||||
An enumeration.
|
||||
|
||||
|
||||
### `_member_type_`
|
||||
|
||||
`builtins.str` 的别名
|
||||
|
||||
|
||||
## _class_ `MessageEvent`
|
||||
|
||||
基类:`nonebot.adapters.ding.event.Event`
|
||||
|
||||
|
||||
### `get_type()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件类型的方法,类型通常为 NoneBot 内置的四种类型。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `Literal["message", "notice", "request", "meta_event"]`
|
||||
|
||||
|
||||
|
||||
### `get_event_name()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件名称的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_event_description()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件描述的方法,通常为事件具体内容。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_message()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件消息内容的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `Message`
|
||||
|
||||
|
||||
|
||||
### `get_plaintext()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取消息纯文本的方法,通常不需要修改,默认通过 `get_message().extract_plain_text` 获取。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_user_id()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件主体 id 的方法,通常是用户 id 。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
### `get_session_id()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取会话 id 的方法,用于判断当前事件属于哪一个会话,通常是用户 id、群组 id 组合。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `str`
|
||||
|
||||
|
||||
|
||||
## _class_ `PrivateMessageEvent`
|
||||
|
||||
基类:`nonebot.adapters.ding.event.MessageEvent`
|
||||
|
||||
|
||||
## _class_ `GroupMessageEvent`
|
||||
|
||||
基类:`nonebot.adapters.ding.event.MessageEvent`
|
||||
|
||||
|
||||
### `is_tome()`
|
||||
|
||||
|
||||
* **说明**
|
||||
|
||||
获取事件是否与机器人有关的方法。
|
||||
|
||||
|
||||
|
||||
* **返回**
|
||||
|
||||
|
||||
* `bool`
|
||||
|
||||
# NoneBot.adapters.ding.message 模块
|
||||
|
||||
|
||||
## _class_ `MessageSegment`
|
||||
@ -488,13 +187,45 @@ An enumeration.
|
||||
钉钉 协议 MessageSegment 适配。具体方法参考协议消息段类型或源码。
|
||||
|
||||
|
||||
### _static_ `atAll()`
|
||||
|
||||
@全体
|
||||
|
||||
|
||||
### _static_ `atMobiles(*mobileNumber)`
|
||||
|
||||
@指定手机号人员
|
||||
|
||||
|
||||
### _static_ `text(text)`
|
||||
|
||||
发送 `text` 类型消息
|
||||
|
||||
|
||||
### _static_ `image(picURL)`
|
||||
|
||||
发送 `image` 类型消息
|
||||
|
||||
|
||||
### _static_ `extension(dict_)`
|
||||
|
||||
"标记 text 文本的 extension 属性,需要与 text 消息段相加。
|
||||
|
||||
|
||||
### _static_ `markdown(title, text)`
|
||||
|
||||
发送 `markdown` 类型消息
|
||||
|
||||
|
||||
### _static_ `actionCardSingleBtn(title, text, singleTitle, singleURL)`
|
||||
|
||||
发送 `actionCardSingleBtn` 类型消息
|
||||
|
||||
|
||||
### _static_ `actionCardMultiBtns(title, text, btns, hideAvatar=False, btnOrientation='1')`
|
||||
|
||||
发送 `actionCardMultiBtn` 类型消息
|
||||
|
||||
|
||||
* **参数**
|
||||
|
||||
@ -508,6 +239,8 @@ An enumeration.
|
||||
|
||||
### _static_ `feedCard(links)`
|
||||
|
||||
发送 `feedCard` 类型消息
|
||||
|
||||
|
||||
* **参数**
|
||||
|
||||
@ -521,3 +254,40 @@ An enumeration.
|
||||
基类:[`nonebot.adapters.Message`](README.md#nonebot.adapters.Message)
|
||||
|
||||
钉钉 协议 Message 适配。
|
||||
|
||||
# NoneBot.adapters.ding.event 模块
|
||||
|
||||
|
||||
## _class_ `Event`
|
||||
|
||||
基类:[`nonebot.adapters.Event`](README.md#nonebot.adapters.Event)
|
||||
|
||||
钉钉协议事件。各事件字段参考 [钉钉文档](https://ding-doc.dingtalk.com/document#/org-dev-guide/elzz1p)
|
||||
|
||||
|
||||
## _class_ `ConversationType`
|
||||
|
||||
基类:`str`, `enum.Enum`
|
||||
|
||||
An enumeration.
|
||||
|
||||
|
||||
## _class_ `MessageEvent`
|
||||
|
||||
基类:`nonebot.adapters.ding.event.Event`
|
||||
|
||||
消息事件
|
||||
|
||||
|
||||
## _class_ `PrivateMessageEvent`
|
||||
|
||||
基类:`nonebot.adapters.ding.event.MessageEvent`
|
||||
|
||||
私聊消息事件
|
||||
|
||||
|
||||
## _class_ `GroupMessageEvent`
|
||||
|
||||
基类:`nonebot.adapters.ding.event.MessageEvent`
|
||||
|
||||
群消息事件
|
||||
|
Reference in New Issue
Block a user