From ed38a54c73584744d2166142313103810bfd389a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 23 Jan 2024 13:01:32 +0000 Subject: [PATCH] :bookmark: Release 2.3.2 --- website/src/pages/changelog.md | 2 +- website/tsconfig.json | 8 +- .../versioned_docs/version-2.3.2/api/.gitkeep | 0 .../version-2.3.2/api/adapter.md | 141 +++++ .../versioned_docs/version-2.3.2/api/bot.md | 243 ++++++++ .../version-2.3.2/api/config.md | 35 ++ .../versioned_docs/version-2.3.2/api/event.md | 540 +++++++++++++++++ .../version-2.3.2/api/exception.md | 45 ++ .../versioned_docs/version-2.3.2/api/index.md | 3 + .../version-2.3.2/api/message.md | 545 ++++++++++++++++++ .../version-2.3.2/api/models/api.md | 37 ++ .../version-2.3.2/api/models/common.md | 457 +++++++++++++++ .../version-2.3.2/api/models/index.md | 1 + .../versioned_docs/version-2.3.2/api/utils.md | 47 ++ .../version-2.3.2/guide/README.md | 9 + .../version-2.3.2/guide/installation.md | 29 + .../version-2.3.2/guide/setup.md | 130 +++++ .../version-2.3.2-sidebars.json | 14 + website/versions.json | 2 +- 19 files changed, 2282 insertions(+), 6 deletions(-) create mode 100644 website/versioned_docs/version-2.3.2/api/.gitkeep create mode 100644 website/versioned_docs/version-2.3.2/api/adapter.md create mode 100644 website/versioned_docs/version-2.3.2/api/bot.md create mode 100644 website/versioned_docs/version-2.3.2/api/config.md create mode 100644 website/versioned_docs/version-2.3.2/api/event.md create mode 100644 website/versioned_docs/version-2.3.2/api/exception.md create mode 100644 website/versioned_docs/version-2.3.2/api/index.md create mode 100644 website/versioned_docs/version-2.3.2/api/message.md create mode 100644 website/versioned_docs/version-2.3.2/api/models/api.md create mode 100644 website/versioned_docs/version-2.3.2/api/models/common.md create mode 100644 website/versioned_docs/version-2.3.2/api/models/index.md create mode 100644 website/versioned_docs/version-2.3.2/api/utils.md create mode 100644 website/versioned_docs/version-2.3.2/guide/README.md create mode 100644 website/versioned_docs/version-2.3.2/guide/installation.md create mode 100644 website/versioned_docs/version-2.3.2/guide/setup.md create mode 100644 website/versioned_sidebars/version-2.3.2-sidebars.json diff --git a/website/src/pages/changelog.md b/website/src/pages/changelog.md index d621ed0..7faee75 100644 --- a/website/src/pages/changelog.md +++ b/website/src/pages/changelog.md @@ -5,7 +5,7 @@ toc_max_heading_level: 2 # 更新日志 -## 最近更新 +## v2.3.2 ### 🐛 Bug 修复 diff --git a/website/tsconfig.json b/website/tsconfig.json index 67f0d88..b700fc8 100644 --- a/website/tsconfig.json +++ b/website/tsconfig.json @@ -6,11 +6,11 @@ "types": [ "node", "@docusaurus/module-type-aliases", - "@nullbot/docusaurus-theme-nonepress", + "@nullbot/docusaurus-theme-nonepress" ], "paths": { "@/*": ["./src/*"], - "@theme/*": ["./src/theme/*"], + "@theme/*": ["./src/theme/*"] }, /* Strict Type-Checking Options */ @@ -31,6 +31,6 @@ /* Use tslib */ "importHelpers": true, - "noEmitHelpers": true, - }, + "noEmitHelpers": true + } } diff --git a/website/versioned_docs/version-2.3.2/api/.gitkeep b/website/versioned_docs/version-2.3.2/api/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/website/versioned_docs/version-2.3.2/api/adapter.md b/website/versioned_docs/version-2.3.2/api/adapter.md new file mode 100644 index 0000000..ec2315f --- /dev/null +++ b/website/versioned_docs/version-2.3.2/api/adapter.md @@ -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 diff --git a/website/versioned_docs/version-2.3.2/api/bot.md b/website/versioned_docs/version-2.3.2/api/bot.md new file mode 100644 index 0000000..f33154b --- /dev/null +++ b/website/versioned_docs/version-2.3.2/api/bot.md @@ -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 diff --git a/website/versioned_docs/version-2.3.2/api/config.md b/website/versioned_docs/version-2.3.2/api/config.md new file mode 100644 index 0000000..641535f --- /dev/null +++ b/website/versioned_docs/version-2.3.2/api/config.md @@ -0,0 +1,35 @@ +# nonebot.adapters.feishu.config + +## _class_ `BotConfig()` {#BotConfig} + +- **说明** + + 飞书适配器机器人配置类 + + :配置项: + + - `app_id`: 飞书开放平台后台“凭证与基础信息”处给出的 App ID + - `app_secret`: 飞书开放平台后台“凭证与基础信息”处给出的 App Secret + - `encrypt_key`: 飞书开放平台后台“事件订阅”处设置的 Encrypt Key + - `verification_token`: 飞书开放平台后台“事件订阅”处设置的 Verification Token + - `is_lark`: 是否使用 Lark(飞书海外版),默认为 false + +- **参数** + + auto + +## _class_ `Config()` {#Config} + +- **说明** + + 飞书适配器全局配置类 + + :配置项: + + - `feishu_api_base`: 飞书国内版开放平台 API Endpoint + - `feishu_lark_api_base`: 飞书海外版(lark)开放平台 API Endpoint + - `feishu_bots`: 飞书适配器 Bot 配置列表,具体配置项参阅 BotConfig 类 + +- **参数** + + auto diff --git a/website/versioned_docs/version-2.3.2/api/event.md b/website/versioned_docs/version-2.3.2/api/event.md new file mode 100644 index 0000000..2c771da --- /dev/null +++ b/website/versioned_docs/version-2.3.2/api/event.md @@ -0,0 +1,540 @@ +# nonebot.adapters.feishu.event + +## _class_ `Event()` {#Event} + +- **说明** + + 飞书协议事件。各事件字段参考 `飞书文档`\_ + + .. \_飞书文档: + https://open.feishu.cn/document/ukTMukTMukTM/uYDNxYjL2QTM24iN0EjN/event-list + +- **参数** + + auto + +### _method_ `get_type()` {#Event-get-type} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_event_name()` {#Event-get-event-name} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_event_description()` {#Event-get-event-description} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_message()` {#Event-get-message} + +- **参数** + + empty + +- **返回** + + - [Message](message.md#Message) + +### _method_ `get_plaintext()` {#Event-get-plaintext} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_user_id()` {#Event-get-user-id} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_session_id()` {#Event-get-session-id} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `is_tome()` {#Event-is-tome} + +- **参数** + + empty + +- **返回** + + - bool + +## _class_ `MessageEvent()` {#MessageEvent} + +- **参数** + + auto + +### _class-var_ `to_me` {#MessageEvent-to-me} + +- **类型:** bool + +- **说明** + + :说明: 消息是否与机器人有关 + + :类型: `bool` + +### _method_ `get_type()` {#MessageEvent-get-type} + +- **参数** + + empty + +- **返回** + + - Literal['message'] + +### _method_ `get_event_name()` {#MessageEvent-get-event-name} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_event_description()` {#MessageEvent-get-event-description} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_message()` {#MessageEvent-get-message} + +- **参数** + + empty + +- **返回** + + - [Message](message.md#Message) + +### _method_ `get_plaintext()` {#MessageEvent-get-plaintext} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_user_id()` {#MessageEvent-get-user-id} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_all_user_id()` {#MessageEvent-get-all-user-id} + +- **参数** + + empty + +- **返回** + + - UserId + +### _method_ `get_session_id()` {#MessageEvent-get-session-id} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `is_tome()` {#MessageEvent-is-tome} + +- **参数** + + empty + +- **返回** + + - bool + +## _class_ `GroupMessageEvent()` {#GroupMessageEvent} + +- **参数** + + auto + +## _class_ `PrivateMessageEvent()` {#PrivateMessageEvent} + +- **参数** + + auto + +## _class_ `NoticeEvent()` {#NoticeEvent} + +- **参数** + + auto + +### _method_ `get_type()` {#NoticeEvent-get-type} + +- **参数** + + empty + +- **返回** + + - Literal['notice'] + +### _method_ `get_event_name()` {#NoticeEvent-get-event-name} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_event_description()` {#NoticeEvent-get-event-description} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_message()` {#NoticeEvent-get-message} + +- **参数** + + empty + +- **返回** + + - [Message](message.md#Message) + +### _method_ `get_plaintext()` {#NoticeEvent-get-plaintext} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_user_id()` {#NoticeEvent-get-user-id} + +- **参数** + + empty + +- **返回** + + - str + +### _method_ `get_session_id()` {#NoticeEvent-get-session-id} + +- **参数** + + empty + +- **返回** + + - str + +## _class_ `MessageReadEvent()` {#MessageReadEvent} + +- **参数** + + auto + +## _class_ `GroupDisbandedEvent()` {#GroupDisbandedEvent} + +- **参数** + + auto + +## _class_ `MessageReactionDeletedEvent()` {#MessageReactionDeletedEvent} + +- **参数** + + auto + +## _class_ `MessageReactionCreatedEvent()` {#MessageReactionCreatedEvent} + +- **参数** + + auto + +## _class_ `GroupConfigUpdatedEvent()` {#GroupConfigUpdatedEvent} + +- **参数** + + auto + +## _class_ `GroupMemberBotAddedEvent()` {#GroupMemberBotAddedEvent} + +- **参数** + + auto + +## _class_ `GroupMemberBotDeletedEvent()` {#GroupMemberBotDeletedEvent} + +- **参数** + + auto + +## _class_ `GroupMemberUserAddedEvent()` {#GroupMemberUserAddedEvent} + +- **参数** + + auto + +## _class_ `GroupMemberUserWithdrawnEvent()` {#GroupMemberUserWithdrawnEvent} + +- **参数** + + auto + +## _class_ `GroupMemberUserDeletedEvent()` {#GroupMemberUserDeletedEvent} + +- **参数** + + auto + +## _class_ `ContactUserUpdatedEvent()` {#ContactUserUpdatedEvent} + +- **参数** + + auto + +## _class_ `ContactUserDeletedEvent()` {#ContactUserDeletedEvent} + +- **参数** + + auto + +## _class_ `ContactUserCreatedEvent()` {#ContactUserCreatedEvent} + +- **参数** + + auto + +## _class_ `ContactDepartmentUpdatedEvent()` {#ContactDepartmentUpdatedEvent} + +- **参数** + + auto + +## _class_ `ContactDepartmentDeletedEvent()` {#ContactDepartmentDeletedEvent} + +- **参数** + + auto + +## _class_ `ContactDepartmentCreatedEvent()` {#ContactDepartmentCreatedEvent} + +- **参数** + + auto + +## _class_ `CalendarAclCreatedEvent()` {#CalendarAclCreatedEvent} + +- **参数** + + auto + +## _class_ `CalendarAclDeletedEvent()` {#CalendarAclDeletedEvent} + +- **参数** + + auto + +## _class_ `CalendarChangedEvent()` {#CalendarChangedEvent} + +- **参数** + + auto + +## _class_ `CalendarEventChangedEvent()` {#CalendarEventChangedEvent} + +- **参数** + + auto + +## _class_ `DriveFileReadEvent()` {#DriveFileReadEvent} + +- **参数** + + auto + +## _class_ `DriveFileTitleUpdatedEvent()` {#DriveFileTitleUpdatedEvent} + +- **参数** + + auto + +## _class_ `DriveFilePermissionMemberAddedEvent()` {#DriveFilePermissionMemberAddedEvent} + +- **参数** + + auto + +## _class_ `DriveFilePermissionMemberRemovedEvent()` {#DriveFilePermissionMemberRemovedEvent} + +- **参数** + + auto + +## _class_ `DriveFileTrashedEvent()` {#DriveFileTrashedEvent} + +- **参数** + + auto + +## _class_ `DriveFileDeletedEvent()` {#DriveFileDeletedEvent} + +- **参数** + + auto + +## _class_ `DriveFileEditedEvent()` {#DriveFileEditedEvent} + +- **参数** + + auto + +## _class_ `MeetingRoomCreatedEvent()` {#MeetingRoomCreatedEvent} + +- **参数** + + auto + +## _class_ `MeetingRoomUpdatedEvent()` {#MeetingRoomUpdatedEvent} + +- **参数** + + auto + +## _class_ `MeetingRoomDeletedEvent()` {#MeetingRoomDeletedEvent} + +- **参数** + + auto + +## _class_ `MeetingRoomStatusChangedEvent()` {#MeetingRoomStatusChangedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingStartedEvent()` {#VCMeetingStartedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingEndedEvent()` {#VCMeetingEndedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingJoinedEvent()` {#VCMeetingJoinedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingLeftEvent()` {#VCMeetingLeftEvent} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingStartedEvent()` {#VCMeetingRecordingStartedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingEndedEvent()` {#VCMeetingRecordingEndedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingReadyEvent()` {#VCMeetingRecordingReadyEvent} + +- **参数** + + auto + +## _class_ `VCMeetingShareStartedEvent()` {#VCMeetingShareStartedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingShareEndedEvent()` {#VCMeetingShareEndedEvent} + +- **参数** + + auto + +## _class_ `AttendanceUserFlowCreatedEvent()` {#AttendanceUserFlowCreatedEvent} + +- **参数** + + auto + +## _class_ `AttendanceUserTaskUpdatedEvent()` {#AttendanceUserTaskUpdatedEvent} + +- **参数** + + auto diff --git a/website/versioned_docs/version-2.3.2/api/exception.md b/website/versioned_docs/version-2.3.2/api/exception.md new file mode 100644 index 0000000..9e5a234 --- /dev/null +++ b/website/versioned_docs/version-2.3.2/api/exception.md @@ -0,0 +1,45 @@ +# nonebot.adapters.feishu.exception + +## _class_ `FeishuAdapterException()` {#FeishuAdapterException} + +- **参数** + + auto + +## _class_ `ActionFailed()` {#ActionFailed} + +- **说明** + + :说明: + + API 请求返回错误信息。 + + :参数: + + - `retcode: Optional[int]`: 错误码 + +- **参数** + + auto + +## _class_ `NetworkError()` {#NetworkError} + +- **说明** + + :说明: + + 网络错误。 + + :参数: + + - `retcode: Optional[int]`: 错误码 + +- **参数** + + auto + +## _class_ `ApiNotAvailable()` {#ApiNotAvailable} + +- **参数** + + auto diff --git a/website/versioned_docs/version-2.3.2/api/index.md b/website/versioned_docs/version-2.3.2/api/index.md new file mode 100644 index 0000000..6e59ec0 --- /dev/null +++ b/website/versioned_docs/version-2.3.2/api/index.md @@ -0,0 +1,3 @@ +# nonebot.adapters.feishu + +飞书协议适配 diff --git a/website/versioned_docs/version-2.3.2/api/message.md b/website/versioned_docs/version-2.3.2/api/message.md new file mode 100644 index 0000000..e8143fe --- /dev/null +++ b/website/versioned_docs/version-2.3.2/api/message.md @@ -0,0 +1,545 @@ +# nonebot.adapters.feishu.message + +## _class_ `MessageSegment()` {#MessageSegment} + +- **说明:** 飞书 协议 MessageSegment 适配。具体方法参考协议消息段类型或源码。 + +- **参数** + + auto + +### _classmethod_ `get_message_class()` {#MessageSegment-get-message-class} + +- **参数** + + empty + +- **返回** + + - type[Message] + +### _method_ `is_text()` {#MessageSegment-is-text} + +- **参数** + + empty + +- **返回** + + - bool + +### _staticmethod_ `text(text)` {#MessageSegment-text} + +- **参数** + + - `text` (str) + +- **返回** + + - Text + +### _staticmethod_ `at(user_id)` {#MessageSegment-at} + +- **参数** + + - `user_id` (str) + +- **返回** + + - untyped + +### _staticmethod_ `post(title, content, language="zh_cn")` {#MessageSegment-post} + +- **参数** + + - `title` (str) + + - `content` (list[list[PostMessageNode]]) + + - `language` (str) + +- **返回** + + - Post + +### _staticmethod_ `image(image_key)` {#MessageSegment-image} + +- **参数** + + - `image_key` (str) + +- **返回** + + - Image + +### _staticmethod_ `interactive(header, config, elements=None, i18n_elements=None)` {#MessageSegment-interactive} + +- **参数** + + - `header` (InteractiveHeader) + + - `config` (InteractiveConfig) + + - `elements` (list[dict[str, Any]] | None) + + - `i18n_elements` (list[dict[str, Any]] | None) + +- **返回** + + - untyped + +### _staticmethod_ `interactive_template(template_id, template_variable)` {#MessageSegment-interactive-template} + +- **参数** + + - `template_id` (str) + + - `template_variable` (dict[str, Any]) + +- **返回** + + - InteractiveTemplate + +### _staticmethod_ `todo(task_id, summary, due_time)` {#MessageSegment-todo} + +- **参数** + + - `task_id` (str) + + - `summary` (\_PostData) + + - `due_time` (str) + +- **返回** + + - untyped + +### _staticmethod_ `hongbao(text)` {#MessageSegment-hongbao} + +- **参数** + + - `text` (str) + +- **返回** + + - Hongbao + +### _staticmethod_ `system(template, from_user, to_chatters)` {#MessageSegment-system} + +- **参数** + + - `template` (str) + + - `from_user` (list[str]) + + - `to_chatters` (list[str]) + +- **返回** + + - System + +### _staticmethod_ `location(name, longitude, latitude)` {#MessageSegment-location} + +- **参数** + + - `name` (str) + + - `longitude` (str) + + - `latitude` (str) + +- **返回** + + - Location + +### _staticmethod_ `video_chat(topic, start_time)` {#MessageSegment-video-chat} + +- **参数** + + - `topic` (str) + + - `start_time` (str) + +- **返回** + + - untyped + +### _staticmethod_ `share_chat(chat_id)` {#MessageSegment-share-chat} + +- **参数** + + - `chat_id` (str) + +- **返回** + + - MessageSegment + +### _staticmethod_ `share_user(user_id)` {#MessageSegment-share-user} + +- **参数** + + - `user_id` (str) + +- **返回** + + - MessageSegment + +### _staticmethod_ `audio(file_key, duration=None)` {#MessageSegment-audio} + +- **参数** + + - `file_key` (str) + + - `duration` (int | None) + +- **返回** + + - MessageSegment + +### _staticmethod_ `media(file_key, image_key=None, file_name=None, duration=None)` {#MessageSegment-media} + +- **参数** + + - `file_key` (str) + + - `image_key` (str | None) + + - `file_name` (str | None) + + - `duration` (int | None) + +- **返回** + + - MessageSegment + +### _staticmethod_ `file(file_key, file_name=None)` {#MessageSegment-file} + +- **参数** + + - `file_key` (str) + + - `file_name` (str | None) + +- **返回** + + - MessageSegment + +### _staticmethod_ `folder(file_key, file_name)` {#MessageSegment-folder} + +- **参数** + + - `file_key` (str) + + - `file_name` (str) + +- **返回** + + - MessageSegment + +### _staticmethod_ `sticker(file_key)` {#MessageSegment-sticker} + +- **参数** + + - `file_key` (str) + +- **返回** + + - MessageSegment + +### _method_ `to_post()` {#MessageSegment-to-post} + +- **参数** + + empty + +- **返回** + + - untyped + +## _class_ `Text()` {#Text} + +- **说明:** Text(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `At()` {#At} + +- **说明:** At(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `Image()` {#Image} + +- **说明:** Image(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `InteractiveHeaderTitle()` {#InteractiveHeaderTitle} + +- **参数** + + auto + +## _class_ `InteractiveHeader()` {#InteractiveHeader} + +- **参数** + + auto + +## _class_ `InteractiveConfig()` {#InteractiveConfig} + +- **参数** + + auto + +## _class_ `Interactive()` {#Interactive} + +- **参数** + + auto + +## _class_ `InteractiveTemplate()` {#InteractiveTemplate} + +- **说明:** InteractiveTemplate(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `ShareChat()` {#ShareChat} + +- **说明:** ShareChat(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `ShareUser()` {#ShareUser} + +- **说明:** ShareUser(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `Audio()` {#Audio} + +- **说明:** Audio(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `Media()` {#Media} + +- **说明:** Media(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `File()` {#File} + +- **说明:** File(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `Folder()` {#Folder} + +- **说明:** Folder(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `Sticker()` {#Sticker} + +- **说明:** Sticker(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `PostMessageNode()` {#PostMessageNode} + +- **参数** + + auto + +## _class_ `PostMessageNodeStylable()` {#PostMessageNodeStylable} + +- **参数** + + auto + +## _class_ `PostText()` {#PostText} + +- **参数** + + auto + +## _class_ `PostA()` {#PostA} + +- **参数** + + auto + +## _class_ `PostAt()` {#PostAt} + +- **参数** + + auto + +## _class_ `PostImg()` {#PostImg} + +- **参数** + + auto + +## _class_ `PostMedia()` {#PostMedia} + +- **参数** + + auto + +## _class_ `PostEmotion()` {#PostEmotion} + +- **参数** + + auto + +## _class_ `Post()` {#Post} + +- **说明:** Post(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `System()` {#System} + +- **说明:** System(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `Location()` {#Location} + +- **说明:** Location(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `VideoChat()` {#VideoChat} + +- **说明:** VideoChat(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `Todo()` {#Todo} + +- **说明:** Todo(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `Vote()` {#Vote} + +- **说明:** Vote(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `Hongbao()` {#Hongbao} + +- **说明:** Hongbao(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `ShareCalendarEvent()` {#ShareCalendarEvent} + +- **说明:** ShareCalendarEvent(type: str, data: Dict[str, Any] = ) + +- **参数** + + auto + +## _class_ `Calendar()` {#Calendar} + +- **参数** + + auto + +## _class_ `GeneralCalendar()` {#GeneralCalendar} + +- **参数** + + auto + +## _class_ `Message()` {#Message} + +- **说明:** 飞书 协议 Message 适配。 + +- **参数** + + auto + +### _classmethod_ `get_segment_class()` {#Message-get-segment-class} + +- **参数** + + empty + +- **返回** + + - type[MessageSegment] + +### _method_ `serialize()` {#Message-serialize} + +- **参数** + + empty + +- **返回** + + - tuple[str, str] + +### _staticmethod_ `deserialize(content, mentions, message_type)` {#Message-deserialize} + +- **参数** + + - `content` (str) + + - `mentions` (list[Mention] | None) + + - `message_type` (str) + +- **返回** + + - Message + +### _method_ `extract_plain_text()` {#Message-extract-plain-text} + +- **参数** + + empty + +- **返回** + + - str diff --git a/website/versioned_docs/version-2.3.2/api/models/api.md b/website/versioned_docs/version-2.3.2/api/models/api.md new file mode 100644 index 0000000..e356976 --- /dev/null +++ b/website/versioned_docs/version-2.3.2/api/models/api.md @@ -0,0 +1,37 @@ +# nonebot.adapters.feishu.models.api + +## _class_ `BaseResponse()` {#BaseResponse} + +- **参数** + + auto + +## _class_ `TenantAccessTokenResponse()` {#TenantAccessTokenResponse} + +- **参数** + + auto + +## _class_ `BotInfo()` {#BotInfo} + +- **参数** + + auto + +## _class_ `BotInfoResponse()` {#BotInfoResponse} + +- **参数** + + auto + +## _class_ `ReplyResponseItems()` {#ReplyResponseItems} + +- **参数** + + auto + +## _class_ `ReplyResponse()` {#ReplyResponse} + +- **参数** + + auto diff --git a/website/versioned_docs/version-2.3.2/api/models/common.md b/website/versioned_docs/version-2.3.2/api/models/common.md new file mode 100644 index 0000000..014f8a0 --- /dev/null +++ b/website/versioned_docs/version-2.3.2/api/models/common.md @@ -0,0 +1,457 @@ +# nonebot.adapters.feishu.models.common + +## _class_ `EventHeader()` {#EventHeader} + +- **参数** + + auto + +## _class_ `UserId()` {#UserId} + +- **参数** + + auto + +## _class_ `MeetingUser()` {#MeetingUser} + +- **参数** + + auto + +## _class_ `Meeting()` {#Meeting} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingReadyEventDetail()` {#VCMeetingRecordingReadyEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingEndedEventDetail()` {#VCMeetingRecordingEndedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingStartedEventDetail()` {#VCMeetingRecordingStartedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingLeftEventDetail()` {#VCMeetingLeftEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingJoinedEventDetail()` {#VCMeetingJoinedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingEndedEventDetail()` {#VCMeetingEndedEventDetail} + +- **参数** + + auto + +## _class_ `Sender()` {#Sender} + +- **参数** + + auto + +## _class_ `ReplySender()` {#ReplySender} + +- **参数** + + auto + +## _class_ `Mention()` {#Mention} + +- **参数** + + auto + +## _class_ `ReplyMention()` {#ReplyMention} + +- **参数** + + auto + +## _class_ `MessageBody()` {#MessageBody} + +- **参数** + + auto + +## _class_ `Reply()` {#Reply} + +- **参数** + + auto + +## _class_ `EventMessage()` {#EventMessage} + +- **参数** + + auto + +## _class_ `GroupEventMessage()` {#GroupEventMessage} + +- **参数** + + auto + +## _class_ `PrivateEventMessage()` {#PrivateEventMessage} + +- **参数** + + auto + +## _class_ `MessageEventDetail()` {#MessageEventDetail} + +- **参数** + + auto + +## _class_ `GroupMessageEventDetail()` {#GroupMessageEventDetail} + +- **参数** + + auto + +## _class_ `PrivateMessageEventDetail()` {#PrivateMessageEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingShareStartedEventDetail()` {#VCMeetingShareStartedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingShareEndedEventDetail()` {#VCMeetingShareEndedEventDetail} + +- **参数** + + auto + +## _class_ `AttendanceUserFlowCreatedEventDetail()` {#AttendanceUserFlowCreatedEventDetail} + +- **参数** + + auto + +## _class_ `AttendanceUserTaskStatusDiff()` {#AttendanceUserTaskStatusDiff} + +- **参数** + + auto + +## _class_ `AttendanceUserTaskUpdatedEventDetail()` {#AttendanceUserTaskUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingStartedEventDetail()` {#VCMeetingStartedEventDetail} + +- **参数** + + auto + +## _class_ `MeetingRoomStatusChangedEventDetail()` {#MeetingRoomStatusChangedEventDetail} + +- **参数** + + auto + +## _class_ `MeetingRoomDeletedEventDetail()` {#MeetingRoomDeletedEventDetail} + +- **参数** + + auto + +## _class_ `MeetingRoomUpdatedEventDetail()` {#MeetingRoomUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `MeetingRoomCreatedEventDetail()` {#MeetingRoomCreatedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFileEditedEventDetail()` {#DriveFileEditedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFileDeletedEventDetail()` {#DriveFileDeletedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFileTrashedEventDetail()` {#DriveFileTrashedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFilePermissionMemberRemovedEventDetail()` {#DriveFilePermissionMemberRemovedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFilePermissionMemberAddedEventDetail()` {#DriveFilePermissionMemberAddedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFileTitleUpdatedEventDetail()` {#DriveFileTitleUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFileReadEventDetail()` {#DriveFileReadEventDetail} + +- **参数** + + auto + +## _class_ `CalendarEventChangedEventDetail()` {#CalendarEventChangedEventDetail} + +- **参数** + + auto + +## _class_ `CalendarAclScope()` {#CalendarAclScope} + +- **参数** + + auto + +## _class_ `CalendarAclDeletedEventDetail()` {#CalendarAclDeletedEventDetail} + +- **参数** + + auto + +## _class_ `CalendarAclCreatedEventDetail()` {#CalendarAclCreatedEventDetail} + +- **参数** + + auto + +## _class_ `ContactDepartmentStatus()` {#ContactDepartmentStatus} + +- **参数** + + auto + +## _class_ `ContactDepartment()` {#ContactDepartment} + +- **参数** + + auto + +## _class_ `ContactDepartmentCreatedEventDetail()` {#ContactDepartmentCreatedEventDetail} + +- **参数** + + auto + +## _class_ `OldContactDepartment()` {#OldContactDepartment} + +- **参数** + + auto + +## _class_ `ContactDepartmentDeletedEventDetail()` {#ContactDepartmentDeletedEventDetail} + +- **参数** + + auto + +## _class_ `ContactDepartmentUpdatedEventDetail()` {#ContactDepartmentUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `AvatarInfo()` {#AvatarInfo} + +- **参数** + + auto + +## _class_ `UserStatus()` {#UserStatus} + +- **参数** + + auto + +## _class_ `UserOrder()` {#UserOrder} + +- **参数** + + auto + +## _class_ `UserCustomAttrValue()` {#UserCustomAttrValue} + +- **参数** + + auto + +## _class_ `UserCustomAttr()` {#UserCustomAttr} + +- **参数** + + auto + +## _class_ `ContactUser()` {#ContactUser} + +- **参数** + + auto + +## _class_ `OldContactUser()` {#OldContactUser} + +- **参数** + + auto + +## _class_ `ContactUserCreatedEventDetail()` {#ContactUserCreatedEventDetail} + +- **参数** + + auto + +## _class_ `ContactUserDeletedEventDetail()` {#ContactUserDeletedEventDetail} + +- **参数** + + auto + +## _class_ `ContactUserUpdatedEventDetail()` {#ContactUserUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `ChatMemberUser()` {#ChatMemberUser} + +- **参数** + + auto + +## _class_ `GroupMemberUserDeletedEventDetail()` {#GroupMemberUserDeletedEventDetail} + +- **参数** + + auto + +## _class_ `GroupMemberUserWithdrawnEventDetail()` {#GroupMemberUserWithdrawnEventDetail} + +- **参数** + + auto + +## _class_ `GroupMemberUserAddedEventDetail()` {#GroupMemberUserAddedEventDetail} + +- **参数** + + auto + +## _class_ `GroupMemberBotDeletedEventDetail()` {#GroupMemberBotDeletedEventDetail} + +- **参数** + + auto + +## _class_ `GroupMemberBotAddedEventDetail()` {#GroupMemberBotAddedEventDetail} + +- **参数** + + auto + +## _class_ `I18nNames()` {#I18nNames} + +- **参数** + + auto + +## _class_ `Emoji()` {#Emoji} + +- **参数** + + auto + +## _class_ `ChatChange()` {#ChatChange} + +- **参数** + + auto + +## _class_ `EventModerator()` {#EventModerator} + +- **参数** + + auto + +## _class_ `ModeratorList()` {#ModeratorList} + +- **参数** + + auto + +## _class_ `GroupConfigUpdatedEventDetail()` {#GroupConfigUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `MessageReactionCreatedEventDetail()` {#MessageReactionCreatedEventDetail} + +- **参数** + + auto + +## _class_ `MessageReactionDeletedEventDetail()` {#MessageReactionDeletedEventDetail} + +- **参数** + + auto + +## _class_ `GroupDisbandedEventDetail()` {#GroupDisbandedEventDetail} + +- **参数** + + auto + +## _class_ `MessageReader()` {#MessageReader} + +- **参数** + + auto + +## _class_ `MessageReadEventDetail()` {#MessageReadEventDetail} + +- **参数** + + auto diff --git a/website/versioned_docs/version-2.3.2/api/models/index.md b/website/versioned_docs/version-2.3.2/api/models/index.md new file mode 100644 index 0000000..5905810 --- /dev/null +++ b/website/versioned_docs/version-2.3.2/api/models/index.md @@ -0,0 +1 @@ +# nonebot.adapters.feishu.models diff --git a/website/versioned_docs/version-2.3.2/api/utils.md b/website/versioned_docs/version-2.3.2/api/utils.md new file mode 100644 index 0000000..118ec48 --- /dev/null +++ b/website/versioned_docs/version-2.3.2/api/utils.md @@ -0,0 +1,47 @@ +# nonebot.adapters.feishu.utils + +## _def_ `log()` {#log} + +- **参数** + + auto + +- **返回** + + - untyped + +## _class_ `AESCipher(key)` {#AESCipher} + +- **参数** + + - `key` + +### _staticmethod_ `str_to_bytes(data)` {#AESCipher-str-to-bytes} + +- **参数** + + - `data` + +- **返回** + + - untyped + +### _method_ `decrypt(enc)` {#AESCipher-decrypt} + +- **参数** + + - `enc` + +- **返回** + + - untyped + +### _method_ `decrypt_string(enc)` {#AESCipher-decrypt-string} + +- **参数** + + - `enc` + +- **返回** + + - untyped diff --git a/website/versioned_docs/version-2.3.2/guide/README.md b/website/versioned_docs/version-2.3.2/guide/README.md new file mode 100644 index 0000000..5e1c0d7 --- /dev/null +++ b/website/versioned_docs/version-2.3.2/guide/README.md @@ -0,0 +1,9 @@ +--- +sidebar_position: 0 +id: index +description: 飞书适配器概览 + +slug: /guide/ +--- + +# 概览 diff --git a/website/versioned_docs/version-2.3.2/guide/installation.md b/website/versioned_docs/version-2.3.2/guide/installation.md new file mode 100644 index 0000000..860b0b6 --- /dev/null +++ b/website/versioned_docs/version-2.3.2/guide/installation.md @@ -0,0 +1,29 @@ +--- +sidebar_position: 1 +description: 安装 + +options: + menu: + - category: guide + weight: 20 +--- + +# 安装飞书适配器 + +```bash +pip install nonebot-adapter-feishu +``` + +## 注册飞书适配器 + +在 `bot.py` 中添加: + +```python title=bot.py {2,7} +import nonebot +from nonebot.adapters.feishu import Adapter as FeishuAdapter + +nonebot.init() + +driver = nonebot.get_driver() +driver.register_adapter(FeishuAdapter) +``` diff --git a/website/versioned_docs/version-2.3.2/guide/setup.md b/website/versioned_docs/version-2.3.2/guide/setup.md new file mode 100644 index 0000000..4a3ca11 --- /dev/null +++ b/website/versioned_docs/version-2.3.2/guide/setup.md @@ -0,0 +1,130 @@ +--- +sidebar_position: 2 +description: 配置连接 + +options: + menu: + - category: guide + weight: 30 +--- + +# 配置连接 + +## 配置驱动器 + +飞书适配器需要同时启用正向驱动器及 ASGI 驱动器,例如安装 httpx(正向)和 fastapi(ASGI): + +```bash +pip install nonebot[httpx] nonebot[fastapi] +``` + +同时需要在 .env 配置文件中启用对应的驱动器,例如: + +```dotenv +DRIVER=~fastapi+~httpx +``` + +## 创建应用与启用应用“机器人”能力 + +:::tip 提示 +此部分可参考[飞书开放平台-快速开发机器人-创建应用](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app)部分的文档。 + +::: + +## 在 NoneBot 配置文件中添加相应配置 + +复制所创建应用 **基础信息** > **凭证和基础信息** 中的 **App ID** 、 **App Secret** 和 **“事件订阅”** 中的 **Verification Token** ,替换以下配置模板中的值。 + +如果在飞书开发者后台的事件订阅中配置了事件上报的 Encrypt Key,也需要传入 FEISHU_BOTS 中。 + +当 `encrypt_key` 存在且不为空时,飞书适配器会认为用户启用了加密机制,并对事件上报中的密文进行解密。 + +如果不需要启用加密功能,请将配置项中的 `encrypt_key` 键值对删去,或将 `encrypt_key` 置为 `null`。 + +对于[Lark(飞书平台海外版)](https://www.larksuite.com) 的用户,飞书适配器也提供**实验性**支持,仅需要在配置文件中将 `is_lark` 改为 `true`。 + +```bash +FEISHU_BOTS=' +[ + { + "app_id": "", + "app_secret": "", + "verification_token": "", + "encrypt_key": "", + "is_lark": false + } +] +' +``` + +飞书适配器支持同时传入多份配置,仅需要按相同格式传入 `FEISHU_BOTS` 即可。 + +```bash +FEISHU_BOTS=' +[ + { + "app_id": "", + "app_secret": "", + "verification_token": "", + "encrypt_key": "", + "is_lark": false + }, + { + "app_id": "", + "app_secret": "", + "verification_token": "", + "encrypt_key": "", + "is_lark": false + } +] +``` + +## 开启应用权限 + +应用拥有所需权限后,才能调用飞书接口获取相关信息。如果需要用到所有飞书平台的 API,请开启所有应用权限。 + +在仅群聊功能的情况下,需要为应用开启用户、消息、通讯录和群聊权限组所有权限,并且启用机器人角色以便获取机器人昵称。 + +## 配置飞书事件订阅 + +### 配置上报地址 + +在 **开发配置** > **事件与回调** 选单中使用以下地址作为事件订阅上报入口点,对应的以 `$` 开头的变量请使用 `.env.*` 文件中所定义的值进行替换,`$app_id` 替换为飞书开放平台提供的 App ID。 + +```bash +http://$HOST:$PORT/feishu/$app_id +``` + +### 配置事件订阅列表 + +:::tip 提示 + +在添加事件订阅时请注意,带有**(历史版本)**字样的事件的格式为**不受支持的旧版事件格式**,请使用对应的**新版事件(不带历史版本字样)作为替代**。 + +::: + +## 编写一个适用于飞书适配器的插件并加载 + +插件代码范例: + +```python +from nonebot.plugin import on_command +from nonebot.typing import T_State +from nonebot.adapters.feishu import Bot as FeishuBot, MessageEvent + +helper = on_command("say") + + +@helper.handle() +async def feishu_helper( + bot: FeishuBot, + event: MessageEvent, + state: T_State, + command_arg: Message = CommandArg(), +): + await helper.finish(command_arg, at_sender=True) +``` + +以上代码注册了一个对飞书平台适用的 `say` 指令,并会提取 `/say` 之后的内容发送到事件所对应的群或私聊。 + +大功告成!现在可以试试向机器人发送类似 `/say Hello, Feishu!` 的消息进行测试了。 diff --git a/website/versioned_sidebars/version-2.3.2-sidebars.json b/website/versioned_sidebars/version-2.3.2-sidebars.json new file mode 100644 index 0000000..cb60e72 --- /dev/null +++ b/website/versioned_sidebars/version-2.3.2-sidebars.json @@ -0,0 +1,14 @@ +{ + "guide": [ + { + "type": "autogenerated", + "dirName": "guide" + } + ], + "api": [ + { + "type": "autogenerated", + "dirName": "api" + } + ] +} diff --git a/website/versions.json b/website/versions.json index f87b99b..6a6c96e 100644 --- a/website/versions.json +++ b/website/versions.json @@ -1 +1 @@ -["2.3.1", "2.3.0"] +["2.3.2", "2.3.1", "2.3.0"]