diff --git a/website/src/pages/changelog.md b/website/src/pages/changelog.md index 3b47263..d7b101b 100644 --- a/website/src/pages/changelog.md +++ b/website/src/pages/changelog.md @@ -5,7 +5,7 @@ toc_max_heading_level: 2 # 更新日志 -## 最近更新 +## v2.0.1 ### 🐛 Bug 修复 diff --git a/website/versioned_docs/version-2.0.1/api/.gitkeep b/website/versioned_docs/version-2.0.1/api/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/website/versioned_docs/version-2.0.1/api/adapter.md b/website/versioned_docs/version-2.0.1/api/adapter.md new file mode 100644 index 0000000..16720b9 --- /dev/null +++ b/website/versioned_docs/version-2.0.1/api/adapter.md @@ -0,0 +1,97 @@ +# 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 + +### _method_ `setup()` {#Adapter-setup} + +- **参数** + + empty + +- **返回** + + - None + +### _async method_ `get_tenant_access_token(bot_config)` {#Adapter-get-tenant-access-token} + +- **参数** + + - `bot_config` ([BotConfig](config.md#BotConfig)) + +- **返回** + + - str + +### _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.0.1/api/bot.md b/website/versioned_docs/version-2.0.1/api/bot.md new file mode 100644 index 0000000..e4f8451 --- /dev/null +++ b/website/versioned_docs/version-2.0.1/api/bot.md @@ -0,0 +1,109 @@ +# 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_ `BotInfo()` {#BotInfo} + +- **参数** + + auto + +## _class_ `Bot(adapter, self_id, *, bot_config, bot_info)` {#Bot} + +- **说明:** 飞书 协议 Bot 适配。继承属性参考 `BaseBot <./#class-basebot>`\_ 。 + +- **参数** + + - `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_ `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} + +- **说明:** :说明: 调用 OneBot 协议 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.0.1/api/config.md b/website/versioned_docs/version-2.0.1/api/config.md new file mode 100644 index 0000000..641535f --- /dev/null +++ b/website/versioned_docs/version-2.0.1/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.0.1/api/event.md b/website/versioned_docs/version-2.0.1/api/event.md new file mode 100644 index 0000000..5d7af10 --- /dev/null +++ b/website/versioned_docs/version-2.0.1/api/event.md @@ -0,0 +1,1006 @@ +# nonebot.adapters.feishu.event + +## _class_ `EventHeader()` {#EventHeader} + +- **参数** + + auto + +## _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_ `UserId()` {#UserId} + +- **参数** + + 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 + +### _classmethod_ `parse_message(values)` {#EventMessage-parse-message} + +- **参数** + + - `values` (dict) + +- **返回** + + - untyped + +## _class_ `GroupEventMessage()` {#GroupEventMessage} + +- **参数** + + auto + +## _class_ `PrivateEventMessage()` {#PrivateEventMessage} + +- **参数** + + auto + +## _class_ `MessageEventDetail()` {#MessageEventDetail} + +- **参数** + + auto + +## _class_ `GroupMessageEventDetail()` {#GroupMessageEventDetail} + +- **参数** + + auto + +## _class_ `PrivateMessageEventDetail()` {#PrivateMessageEventDetail} + +- **参数** + + auto + +## _class_ `MessageEvent()` {#MessageEvent} + +- **参数** + + auto + +### _class-var_ `to_me` {#MessageEvent-to-me} + +- **类型:** bool + +- **说明** + + :说明: 消息是否与机器人有关 + + :类型: `bool` + +### _method_ `get_type()` {#MessageEvent-get-type} + +- **参数** + + empty + +- **返回** + + - Literal['message', 'notice'] + +### _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['message', '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_ `MessageReader()` {#MessageReader} + +- **参数** + + auto + +## _class_ `MessageReadEventDetail()` {#MessageReadEventDetail} + +- **参数** + + auto + +## _class_ `MessageReadEvent()` {#MessageReadEvent} + +- **参数** + + auto + +## _class_ `GroupDisbandedEventDetail()` {#GroupDisbandedEventDetail} + +- **参数** + + auto + +## _class_ `GroupDisbandedEvent()` {#GroupDisbandedEvent} + +- **参数** + + auto + +## _class_ `Emoji()` {#Emoji} + +- **参数** + + auto + +## _class_ `MessageReactionDeletedEventDetail()` {#MessageReactionDeletedEventDetail} + +- **参数** + + auto + +## _class_ `MessageReactionDeletedEvent()` {#MessageReactionDeletedEvent} + +- **参数** + + auto + +## _class_ `MessageReactionCreatedEventDetail()` {#MessageReactionCreatedEventDetail} + +- **参数** + + auto + +## _class_ `MessageReactionCreatedEvent()` {#MessageReactionCreatedEvent} + +- **参数** + + auto + +## _class_ `I18nNames()` {#I18nNames} + +- **参数** + + auto + +## _class_ `ChatChange()` {#ChatChange} + +- **参数** + + auto + +## _class_ `EventModerator()` {#EventModerator} + +- **参数** + + auto + +## _class_ `ModeratorList()` {#ModeratorList} + +- **参数** + + auto + +## _class_ `GroupConfigUpdatedEventDetail()` {#GroupConfigUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `GroupConfigUpdatedEvent()` {#GroupConfigUpdatedEvent} + +- **参数** + + auto + +## _class_ `GroupMemberBotAddedEventDetail()` {#GroupMemberBotAddedEventDetail} + +- **参数** + + auto + +## _class_ `GroupMemberBotAddedEvent()` {#GroupMemberBotAddedEvent} + +- **参数** + + auto + +## _class_ `GroupMemberBotDeletedEventDetail()` {#GroupMemberBotDeletedEventDetail} + +- **参数** + + auto + +## _class_ `GroupMemberBotDeletedEvent()` {#GroupMemberBotDeletedEvent} + +- **参数** + + auto + +## _class_ `ChatMemberUser()` {#ChatMemberUser} + +- **参数** + + auto + +## _class_ `GroupMemberUserAddedEventDetail()` {#GroupMemberUserAddedEventDetail} + +- **参数** + + auto + +## _class_ `GroupMemberUserAddedEvent()` {#GroupMemberUserAddedEvent} + +- **参数** + + auto + +## _class_ `GroupMemberUserWithdrawnEventDetail()` {#GroupMemberUserWithdrawnEventDetail} + +- **参数** + + auto + +## _class_ `GroupMemberUserWithdrawnEvent()` {#GroupMemberUserWithdrawnEvent} + +- **参数** + + auto + +## _class_ `GroupMemberUserDeletedEventDetail()` {#GroupMemberUserDeletedEventDetail} + +- **参数** + + auto + +## _class_ `GroupMemberUserDeletedEvent()` {#GroupMemberUserDeletedEvent} + +- **参数** + + 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_ `ContactUserUpdatedEventDetail()` {#ContactUserUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `ContactUserUpdatedEvent()` {#ContactUserUpdatedEvent} + +- **参数** + + auto + +## _class_ `ContactUserDeletedEventDetail()` {#ContactUserDeletedEventDetail} + +- **参数** + + auto + +## _class_ `ContactUserDeletedEvent()` {#ContactUserDeletedEvent} + +- **参数** + + auto + +## _class_ `ContactUserCreatedEventDetail()` {#ContactUserCreatedEventDetail} + +- **参数** + + auto + +## _class_ `ContactUserCreatedEvent()` {#ContactUserCreatedEvent} + +- **参数** + + auto + +## _class_ `ContactDepartmentStatus()` {#ContactDepartmentStatus} + +- **参数** + + auto + +## _class_ `ContactDepartment()` {#ContactDepartment} + +- **参数** + + auto + +## _class_ `ContactDepartmentUpdatedEventDetail()` {#ContactDepartmentUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `ContactDepartmentUpdatedEvent()` {#ContactDepartmentUpdatedEvent} + +- **参数** + + auto + +## _class_ `OldContactDepartment()` {#OldContactDepartment} + +- **参数** + + auto + +## _class_ `ContactDepartmentDeletedEventDetail()` {#ContactDepartmentDeletedEventDetail} + +- **参数** + + auto + +## _class_ `ContactDepartmentDeletedEvent()` {#ContactDepartmentDeletedEvent} + +- **参数** + + auto + +## _class_ `ContactDepartmentCreatedEventDetail()` {#ContactDepartmentCreatedEventDetail} + +- **参数** + + auto + +## _class_ `ContactDepartmentCreatedEvent()` {#ContactDepartmentCreatedEvent} + +- **参数** + + auto + +## _class_ `CalendarAclScope()` {#CalendarAclScope} + +- **参数** + + auto + +## _class_ `CalendarAclCreatedEventDetail()` {#CalendarAclCreatedEventDetail} + +- **参数** + + auto + +## _class_ `CalendarAclCreatedEvent()` {#CalendarAclCreatedEvent} + +- **参数** + + auto + +## _class_ `CalendarAclDeletedEventDetail()` {#CalendarAclDeletedEventDetail} + +- **参数** + + auto + +## _class_ `CalendarAclDeletedEvent()` {#CalendarAclDeletedEvent} + +- **参数** + + auto + +## _class_ `CalendarChangedEvent()` {#CalendarChangedEvent} + +- **参数** + + auto + +## _class_ `CalendarEventChangedEventDetail()` {#CalendarEventChangedEventDetail} + +- **参数** + + auto + +## _class_ `CalendarEventChangedEvent()` {#CalendarEventChangedEvent} + +- **参数** + + auto + +## _class_ `DriveFileReadEventDetail()` {#DriveFileReadEventDetail} + +- **参数** + + auto + +## _class_ `DriveFileReadEvent()` {#DriveFileReadEvent} + +- **参数** + + auto + +## _class_ `DriveFileTitleUpdatedEventDetail()` {#DriveFileTitleUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFileTitleUpdatedEvent()` {#DriveFileTitleUpdatedEvent} + +- **参数** + + auto + +## _class_ `DriveFilePermissionMemberAddedEventDetail()` {#DriveFilePermissionMemberAddedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFilePermissionMemberAddedEvent()` {#DriveFilePermissionMemberAddedEvent} + +- **参数** + + auto + +## _class_ `DriveFilePermissionMemberRemovedEventDetail()` {#DriveFilePermissionMemberRemovedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFilePermissionMemberRemovedEvent()` {#DriveFilePermissionMemberRemovedEvent} + +- **参数** + + auto + +## _class_ `DriveFileTrashedEventDetail()` {#DriveFileTrashedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFileTrashedEvent()` {#DriveFileTrashedEvent} + +- **参数** + + auto + +## _class_ `DriveFileDeletedEventDetail()` {#DriveFileDeletedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFileDeletedEvent()` {#DriveFileDeletedEvent} + +- **参数** + + auto + +## _class_ `DriveFileEditedEventDetail()` {#DriveFileEditedEventDetail} + +- **参数** + + auto + +## _class_ `DriveFileEditedEvent()` {#DriveFileEditedEvent} + +- **参数** + + auto + +## _class_ `MeetingRoomCreatedEventDetail()` {#MeetingRoomCreatedEventDetail} + +- **参数** + + auto + +## _class_ `MeetingRoomCreatedEvent()` {#MeetingRoomCreatedEvent} + +- **参数** + + auto + +## _class_ `MeetingRoomUpdatedEventDetail()` {#MeetingRoomUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `MeetingRoomUpdatedEvent()` {#MeetingRoomUpdatedEvent} + +- **参数** + + auto + +## _class_ `MeetingRoomDeletedEventDetail()` {#MeetingRoomDeletedEventDetail} + +- **参数** + + auto + +## _class_ `MeetingRoomDeletedEvent()` {#MeetingRoomDeletedEvent} + +- **参数** + + auto + +## _class_ `MeetingRoomStatusChangedEventDetail()` {#MeetingRoomStatusChangedEventDetail} + +- **参数** + + auto + +## _class_ `MeetingRoomStatusChangedEvent()` {#MeetingRoomStatusChangedEvent} + +- **参数** + + auto + +## _class_ `MeetingUser()` {#MeetingUser} + +- **参数** + + auto + +## _class_ `Meeting()` {#Meeting} + +- **参数** + + auto + +## _class_ `VCMeetingStartedEventDetail()` {#VCMeetingStartedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingStartedEvent()` {#VCMeetingStartedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingEndedEventDetail()` {#VCMeetingEndedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingEndedEvent()` {#VCMeetingEndedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingJoinedEventDetail()` {#VCMeetingJoinedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingJoinedEvent()` {#VCMeetingJoinedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingLeftEventDetail()` {#VCMeetingLeftEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingLeftEvent()` {#VCMeetingLeftEvent} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingStartedEventDetail()` {#VCMeetingRecordingStartedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingStartedEvent()` {#VCMeetingRecordingStartedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingEndedEventDetail()` {#VCMeetingRecordingEndedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingEndedEvent()` {#VCMeetingRecordingEndedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingReadyEventDetail()` {#VCMeetingRecordingReadyEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingRecordingReadyEvent()` {#VCMeetingRecordingReadyEvent} + +- **参数** + + auto + +## _class_ `VCMeetingShareStartedEventDetail()` {#VCMeetingShareStartedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingShareStartedEvent()` {#VCMeetingShareStartedEvent} + +- **参数** + + auto + +## _class_ `VCMeetingShareEndedEventDetail()` {#VCMeetingShareEndedEventDetail} + +- **参数** + + auto + +## _class_ `VCMeetingShareEndedEvent()` {#VCMeetingShareEndedEvent} + +- **参数** + + auto + +## _class_ `AttendanceUserFlowCreatedEventDetail()` {#AttendanceUserFlowCreatedEventDetail} + +- **参数** + + auto + +## _class_ `AttendanceUserFlowCreatedEvent()` {#AttendanceUserFlowCreatedEvent} + +- **参数** + + auto + +## _class_ `AttendanceUserTaskStatusDiff()` {#AttendanceUserTaskStatusDiff} + +- **参数** + + auto + +## _class_ `AttendanceUserTaskUpdatedEventDetail()` {#AttendanceUserTaskUpdatedEventDetail} + +- **参数** + + auto + +## _class_ `AttendanceUserTaskUpdatedEvent()` {#AttendanceUserTaskUpdatedEvent} + +- **参数** + + auto diff --git a/website/versioned_docs/version-2.0.1/api/exception.md b/website/versioned_docs/version-2.0.1/api/exception.md new file mode 100644 index 0000000..9e5a234 --- /dev/null +++ b/website/versioned_docs/version-2.0.1/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.0.1/api/index.md b/website/versioned_docs/version-2.0.1/api/index.md new file mode 100644 index 0000000..6e59ec0 --- /dev/null +++ b/website/versioned_docs/version-2.0.1/api/index.md @@ -0,0 +1,3 @@ +# nonebot.adapters.feishu + +飞书协议适配 diff --git a/website/versioned_docs/version-2.0.1/api/message.md b/website/versioned_docs/version-2.0.1/api/message.md new file mode 100644 index 0000000..34eeaa9 --- /dev/null +++ b/website/versioned_docs/version-2.0.1/api/message.md @@ -0,0 +1,215 @@ +# 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_ `at(user_id)` {#MessageSegment-at} + +- **参数** + + - `user_id` (str) + +- **返回** + + - MessageSegment + +### _staticmethod_ `text(text)` {#MessageSegment-text} + +- **参数** + + - `text` (str) + +- **返回** + + - MessageSegment + +### _staticmethod_ `post(title, content)` {#MessageSegment-post} + +- **参数** + + - `title` (str) + + - `content` (list) + +- **返回** + + - MessageSegment + +### _staticmethod_ `image(image_key)` {#MessageSegment-image} + +- **参数** + + - `image_key` (str) + +- **返回** + + - MessageSegment + +### _staticmethod_ `interactive(data)` {#MessageSegment-interactive} + +- **参数** + + - `data` (dict) + +- **返回** + + - MessageSegment + +### _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)` {#MessageSegment-audio} + +- **参数** + + - `file_key` (str) + + - `duration` (int) + +- **返回** + + - MessageSegment + +### _staticmethod_ `media(file_key, image_key, file_name, duration)` {#MessageSegment-media} + +- **参数** + + - `file_key` (str) + + - `image_key` (str) + + - `file_name` (str) + + - `duration` (int) + +- **返回** + + - MessageSegment + +### _staticmethod_ `file(file_key, file_name)` {#MessageSegment-file} + +- **参数** + + - `file_key` (str) + + - `file_name` (str) + +- **返回** + + - MessageSegment + +### _staticmethod_ `sticker(file_key)` {#MessageSegment-sticker} + +- **参数** + + - `file_key` (str) + +- **返回** + + - MessageSegment + +## _class_ `Message()` {#Message} + +- **说明:** 飞书 协议 Message 适配。 + +- **参数** + + auto + +### _classmethod_ `get_segment_class()` {#Message-get-segment-class} + +- **参数** + + empty + +- **返回** + + - type[MessageSegment] + +### _method_ `extract_plain_text()` {#Message-extract-plain-text} + +- **参数** + + empty + +- **返回** + + - str + +## _class_ `MessageSerializer()` {#MessageSerializer} + +- **说明:** 飞书 协议 Message 序列化器。 + +- **参数** + + auto + +### _method_ `serialize()` {#MessageSerializer-serialize} + +- **参数** + + empty + +- **返回** + + - tuple[str, str] + +## _class_ `MessageDeserializer()` {#MessageDeserializer} + +- **说明:** 飞书 协议 Message 反序列化器。 + +- **参数** + + auto + +### _method_ `deserialize()` {#MessageDeserializer-deserialize} + +- **参数** + + empty + +- **返回** + + - Message diff --git a/website/versioned_docs/version-2.0.1/api/utils.md b/website/versioned_docs/version-2.0.1/api/utils.md new file mode 100644 index 0000000..118ec48 --- /dev/null +++ b/website/versioned_docs/version-2.0.1/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.0.1/guide/README.md b/website/versioned_docs/version-2.0.1/guide/README.md new file mode 100644 index 0000000..b56e1de --- /dev/null +++ b/website/versioned_docs/version-2.0.1/guide/README.md @@ -0,0 +1,7 @@ +--- +sidebar_position: 0 +id: index +slug: /guide/ +--- + +# 概览 diff --git a/website/versioned_docs/version-2.0.1/guide/installation.md b/website/versioned_docs/version-2.0.1/guide/installation.md new file mode 100644 index 0000000..c42557e --- /dev/null +++ b/website/versioned_docs/version-2.0.1/guide/installation.md @@ -0,0 +1,29 @@ +--- +sidebar_position: 1 +description: 安装 + +options: + menu: + weight: 10 + category: guide +--- + +# 安装飞书适配器 + +```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.0.1/guide/setup.md b/website/versioned_docs/version-2.0.1/guide/setup.md new file mode 100644 index 0000000..e0f47f9 --- /dev/null +++ b/website/versioned_docs/version-2.0.1/guide/setup.md @@ -0,0 +1,94 @@ +--- +sidebar_position: 3 +description: 配置连接 + +options: + menu: + weight: 20 + category: guide +--- + +# 配置连接 + +## 创建应用与启用应用“机器人”能力 + +:::tip 提示 +此部分可参考[飞书开放平台-快速开发机器人-创建应用](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app)部分的文档。 + +::: + +## 在 NoneBot 配置文件中添加相应配置 + +在 `.env` 文件中添加以下配置 + +``` +FEISHU_BOTS=[{"app_id":"","app_secret":"","verification_token":"","encrypt_key":"","is_lark":false}] +``` + +飞书适配器支持同时传入多份配置,仅需要按相同格式传入 `FEISHU_BOTS` 即可。 + +``` +FEISHU_BOTS=[{"app_id":"","app_secret":"","verification_token":"","encrypt_key":"","is_lark":false},{"app_id":"","app_secret":"","verification_token":"","encrypt_key":"","is_lark":false}] +``` + +复制所创建应用**“凭证和基础信息”**中的 **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`。 + +## 开启应用权限 + +应用拥有所需权限后,才能调用飞书接口获取相关信息。如果需要用到所有飞书平台的 API,请开启所有应用权限。 + +在仅群聊功能的情况下,需要为应用开启用户、消息、通讯录和群聊权限组所有权限。 + +## 配置飞书事件订阅 + +### 配置上报地址 + +飞书适配器会自动注册以下地址作为事件订阅上报入口点。 + +由于飞书开放平台的事件订阅并不会上报 App ID,在填写事件订阅请求网址时,请按照如下格式填写,对应的以 `$` 开头的变量请使用 `.env.*` 文件中所定义的值进行替换,`$app_id` 替换为飞书开放平台提供的 App ID。 + +``` +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.0.1-sidebars.json b/website/versioned_sidebars/version-2.0.1-sidebars.json new file mode 100644 index 0000000..c9c4937 --- /dev/null +++ b/website/versioned_sidebars/version-2.0.1-sidebars.json @@ -0,0 +1,14 @@ +{ + "version-2.0.1/guide": [ + { + "type": "autogenerated", + "dirName": "guide" + } + ], + "version-2.0.1/api": [ + { + "type": "autogenerated", + "dirName": "api" + } + ] +} diff --git a/website/versions.json b/website/versions.json index 876407e..e37ab6d 100644 --- a/website/versions.json +++ b/website/versions.json @@ -1 +1 @@ -["2.0.0", "2.0.0-beta.8"] +["2.0.1", "2.0.0", "2.0.0-beta.8"]