-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc4439a
commit b422dfb
Showing
18 changed files
with
2,278 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ toc_max_heading_level: 2 | |
|
||
# 更新日志 | ||
|
||
## 最近更新 | ||
## v2.4.0 | ||
|
||
### 🚀 新功能 | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# nonebot.adapters.feishu.adapter | ||
|
||
## _class_ `Adapter(driver, **kwargs)` {#Adapter} | ||
|
||
- **参数** | ||
|
||
- `driver` (Driver) | ||
|
||
- `**kwargs` (Any) | ||
|
||
### _class-var_ `event_models` {#Adapter-event-models} | ||
|
||
- **类型:** StringTrie | ||
|
||
- **说明:** 所有事件模型索引 | ||
|
||
### _classmethod_ `get_name()` {#Adapter-get-name} | ||
|
||
- **说明:** 适配器名称: `Feishu` | ||
|
||
- **参数** | ||
|
||
empty | ||
|
||
- **返回** | ||
|
||
- str | ||
|
||
### _async method_ `startup()` {#Adapter-startup} | ||
|
||
- **参数** | ||
|
||
empty | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _method_ `setup()` {#Adapter-setup} | ||
|
||
- **参数** | ||
|
||
empty | ||
|
||
- **返回** | ||
|
||
- None | ||
|
||
### _method_ `get_api_url(bot_config, path)` {#Adapter-get-api-url} | ||
|
||
- **参数** | ||
|
||
- `bot_config` ([BotConfig](config.md#BotConfig)) | ||
|
||
- `path` (str) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `get_bot_info(bot_config)` {#Adapter-get-bot-info} | ||
|
||
- **参数** | ||
|
||
- `bot_config` ([BotConfig](config.md#BotConfig)) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `get_tenant_access_token(bot_config)` {#Adapter-get-tenant-access-token} | ||
|
||
- **参数** | ||
|
||
- `bot_config` ([BotConfig](config.md#BotConfig)) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `send_request(request, **data)` {#Adapter-send-request} | ||
|
||
- **参数** | ||
|
||
- `request` (Request) | ||
|
||
- `**data` (Any) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _classmethod_ `json_to_event(json_data)` {#Adapter-json-to-event} | ||
|
||
- **说明:** 将 json 数据转换为 Event 对象。 | ||
|
||
- **参数** | ||
|
||
- `json_data` (Any): json 数据 | ||
|
||
- `self_id`: 当前 Event 对应的 Bot | ||
|
||
- **返回** | ||
|
||
- [Event](event.md#Event) | None: Event 对象,如果解析失败则返回 None | ||
|
||
### _classmethod_ `add_custom_model(model)` {#Adapter-add-custom-model} | ||
|
||
- **说明:** 插入或覆盖一个自定义的 Event 类型。 需提供 `__event__` 属性,进行事件模型索引, 格式为 `{post_type}[.{sub_type}]`,如: `message.private`。 | ||
|
||
- **参数** | ||
|
||
- `model` (type[[Event](event.md#Event)]): 自定义的 Event 类型 | ||
|
||
- **返回** | ||
|
||
- None | ||
|
||
### _classmethod_ `get_event_model(event_name)` {#Adapter-get-event-model} | ||
|
||
- **说明:** 根据事件名获取对应 `Event Model` 及 `FallBack Event Model` 列表, 不包括基类 `Event`。 | ||
|
||
- **参数** | ||
|
||
- `event_name` (str) | ||
|
||
- **返回** | ||
|
||
- list[type[[Event](event.md#Event)]] | ||
|
||
### _classmethod_ `custom_send(send_func)` {#Adapter-custom-send} | ||
|
||
- **说明:** 自定义 Bot 的回复函数。 | ||
|
||
- **参数** | ||
|
||
- `send_func` (([Bot](bot.md#Bot), [Event](event.md#Event), str | [Message](message.md#Message) | [MessageSegment](message.md#MessageSegment)) -> Any) | ||
|
||
- **返回** | ||
|
||
- untyped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,243 @@ | ||
# nonebot.adapters.feishu.bot | ||
|
||
## _async def_ `send(bot, event, message, at_sender=False, **kwargs)` {#send} | ||
|
||
- **说明:** 默认回复消息处理函数。 | ||
|
||
- **参数** | ||
|
||
- `bot` (Bot) | ||
|
||
- `event` ([Event](event.md#Event)) | ||
|
||
- `message` (str | [Message](message.md#Message) | [MessageSegment](message.md#MessageSegment)) | ||
|
||
- `at_sender` (bool) | ||
|
||
- `**kwargs` (Any) | ||
|
||
- **返回** | ||
|
||
- Any | ||
|
||
## _class_ `Bot(adapter, self_id, *, bot_config, bot_info)` {#Bot} | ||
|
||
- **参数** | ||
|
||
- `adapter` ([Adapter](adapter.md#Adapter)) | ||
|
||
- `self_id` (str) | ||
|
||
- `bot_config` ([BotConfig](config.md#BotConfig)) | ||
|
||
- `bot_info` (BotInfo) | ||
|
||
### _async method_ `send_handler(event, message, at_sender=False, **kwargs)` {#Bot-send-handler} | ||
|
||
- **说明:** 默认回复消息处理函数。 | ||
|
||
- **参数** | ||
|
||
- `event` ([Event](event.md#Event)) | ||
|
||
- `message` (str | [Message](message.md#Message) | [MessageSegment](message.md#MessageSegment)) | ||
|
||
- `at_sender` (bool) | ||
|
||
- `**kwargs` (Any) | ||
|
||
- **返回** | ||
|
||
- Any | ||
|
||
### _async method_ `get_msgs(container_id_type, container_id, **params)` {#Bot-get-msgs} | ||
|
||
- **参数** | ||
|
||
- `container_id_type` (Literal['chat']) | ||
|
||
- `container_id` (str) | ||
|
||
- `**params` (Any) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `get_msg_resource(message_id, file_key, type_)` {#Bot-get-msg-resource} | ||
|
||
- **参数** | ||
|
||
- `message_id` (str) | ||
|
||
- `file_key` (str) | ||
|
||
- `type_` (Literal['image', 'file']) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `get_msg(message_id)` {#Bot-get-msg} | ||
|
||
- **参数** | ||
|
||
- `message_id` (str) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `get_msg_read_users(message_id, user_id_type, page_size=None, page_token=None)` {#Bot-get-msg-read-users} | ||
|
||
- **参数** | ||
|
||
- `message_id` (str) | ||
|
||
- `user_id_type` (str) | ||
|
||
- `page_size` (int | None) | ||
|
||
- `page_token` (str | None) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `merge_forward_msg(receive_id_type, receive_id, message_id_list, uuid=None)` {#Bot-merge-forward-msg} | ||
|
||
- **参数** | ||
|
||
- `receive_id_type` (str) | ||
|
||
- `receive_id` (str) | ||
|
||
- `message_id_list` (list[str]) | ||
|
||
- `uuid` (str | None) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `forward_msg(message_id, receive_id, receive_id_type, uuid=None)` {#Bot-forward-msg} | ||
|
||
- **参数** | ||
|
||
- `message_id` (str) | ||
|
||
- `receive_id` (str) | ||
|
||
- `receive_id_type` (str) | ||
|
||
- `uuid` (str | None) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `delete_msg(message_id)` {#Bot-delete-msg} | ||
|
||
- **参数** | ||
|
||
- `message_id` (str) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `edit_msg(message_id, content, msg_type)` {#Bot-edit-msg} | ||
|
||
- **参数** | ||
|
||
- `message_id` (str) | ||
|
||
- `content` (str) | ||
|
||
- `msg_type` (str) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `reply_msg(message_id, content, msg_type, uuid=None)` {#Bot-reply-msg} | ||
|
||
- **参数** | ||
|
||
- `message_id` (str) | ||
|
||
- `content` (str) | ||
|
||
- `msg_type` (str) | ||
|
||
- `uuid` (str | None) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `send_msg(receive_id_type, receive_id, content, msg_type)` {#Bot-send-msg} | ||
|
||
- **参数** | ||
|
||
- `receive_id_type` (Literal['chat\_id', 'open\_id']) | ||
|
||
- `receive_id` (str) | ||
|
||
- `content` (str) | ||
|
||
- `msg_type` (str) | ||
|
||
- **返回** | ||
|
||
- untyped | ||
|
||
### _async method_ `send(event, message, **kwargs)` {#Bot-send} | ||
|
||
- **说明:** 根据 `event` 向触发事件的主体回复消息。 | ||
|
||
- **参数** | ||
|
||
- `event` ([Event](event.md#Event)): Event 对象 | ||
|
||
- `message` (str | [Message](message.md#Message) | [MessageSegment](message.md#MessageSegment)): 要发送的消息 | ||
|
||
- `at_sender` (bool): 是否 @ 事件主体 | ||
|
||
- `**kwargs` (Any): 其他参数,可以与 [Adapter.custom_send](adapter.md#Adapter-custom-send) 配合使用 | ||
|
||
- **返回** | ||
|
||
- Any: API 调用返回数据 | ||
|
||
- **异常** | ||
|
||
- ValueError: 缺少 `user_id`, `group_id` | ||
|
||
- NetworkError: 网络错误 | ||
|
||
- ActionFailed: API 调用失败 | ||
|
||
### _async method_ `call_api(api, **data)` {#Bot-call-api} | ||
|
||
- **说明:** :说明: 调用 飞书 协议 API :参数: _ `api: str`: API 名称 _ `**data: Any`: API 参数 :返回: - `Any`: API 调用返回数据 :异常: - `NetworkError`: 网络错误 - `ActionFailed`: API 调用失败 | ||
|
||
- **参数** | ||
|
||
- `api` (str) | ||
|
||
- `**data` | ||
|
||
- **返回** | ||
|
||
- Any | ||
|
||
### _async method_ `handle_event(event)` {#Bot-handle-event} | ||
|
||
- **参数** | ||
|
||
- `event` ([Event](event.md#Event)) | ||
|
||
- **返回** | ||
|
||
- None |
Oops, something went wrong.