@colinlu50/openclaw-lark-stream 2026.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +141 -0
- package/README.zh.md +70 -0
- package/bin/openclaw-lark.js +48 -0
- package/index.d.ts +36 -0
- package/index.js +118 -0
- package/openclaw.plugin.json +10 -0
- package/package.json +66 -0
- package/skills/feishu-bitable/SKILL.md +248 -0
- package/skills/feishu-bitable/references/examples.md +813 -0
- package/skills/feishu-bitable/references/field-properties.md +763 -0
- package/skills/feishu-bitable/references/record-values.md +911 -0
- package/skills/feishu-calendar/SKILL.md +244 -0
- package/skills/feishu-channel-rules/SKILL.md +24 -0
- package/skills/feishu-channel-rules/references/markdown-syntax.md +138 -0
- package/skills/feishu-create-doc/SKILL.md +719 -0
- package/skills/feishu-fetch-doc/SKILL.md +93 -0
- package/skills/feishu-im-read/SKILL.md +163 -0
- package/skills/feishu-task/SKILL.md +293 -0
- package/skills/feishu-troubleshoot/SKILL.md +70 -0
- package/skills/feishu-update-doc/SKILL.md +285 -0
- package/src/card/builder.d.ts +106 -0
- package/src/card/builder.js +443 -0
- package/src/card/cardkit.d.ts +90 -0
- package/src/card/cardkit.js +181 -0
- package/src/card/flush-controller.d.ts +45 -0
- package/src/card/flush-controller.js +134 -0
- package/src/card/image-resolver.d.ts +45 -0
- package/src/card/image-resolver.js +112 -0
- package/src/card/markdown-style.d.ts +16 -0
- package/src/card/markdown-style.js +97 -0
- package/src/card/reply-dispatcher-types.d.ts +120 -0
- package/src/card/reply-dispatcher-types.js +57 -0
- package/src/card/reply-dispatcher.d.ts +15 -0
- package/src/card/reply-dispatcher.js +299 -0
- package/src/card/reply-mode.d.ts +38 -0
- package/src/card/reply-mode.js +65 -0
- package/src/card/streaming-card-controller.d.ts +101 -0
- package/src/card/streaming-card-controller.js +810 -0
- package/src/card/unavailable-guard.d.ts +35 -0
- package/src/card/unavailable-guard.js +83 -0
- package/src/channel/abort-detect.d.ts +34 -0
- package/src/channel/abort-detect.js +124 -0
- package/src/channel/chat-queue.d.ts +41 -0
- package/src/channel/chat-queue.js +58 -0
- package/src/channel/config-adapter.d.ts +23 -0
- package/src/channel/config-adapter.js +101 -0
- package/src/channel/directory.d.ts +57 -0
- package/src/channel/directory.js +191 -0
- package/src/channel/event-handlers.d.ts +15 -0
- package/src/channel/event-handlers.js +221 -0
- package/src/channel/monitor.d.ts +17 -0
- package/src/channel/monitor.js +129 -0
- package/src/channel/onboarding-config.d.ts +17 -0
- package/src/channel/onboarding-config.js +88 -0
- package/src/channel/onboarding-migrate.d.ts +25 -0
- package/src/channel/onboarding-migrate.js +67 -0
- package/src/channel/onboarding.d.ts +12 -0
- package/src/channel/onboarding.js +296 -0
- package/src/channel/plugin.d.ts +13 -0
- package/src/channel/plugin.js +278 -0
- package/src/channel/probe.d.ts +14 -0
- package/src/channel/probe.js +21 -0
- package/src/channel/types.d.ts +36 -0
- package/src/channel/types.js +7 -0
- package/src/commands/auth.d.ts +21 -0
- package/src/commands/auth.js +161 -0
- package/src/commands/diagnose.d.ts +69 -0
- package/src/commands/diagnose.js +807 -0
- package/src/commands/doctor.d.ts +26 -0
- package/src/commands/doctor.js +584 -0
- package/src/commands/index.d.ts +25 -0
- package/src/commands/index.js +212 -0
- package/src/commands/locale.d.ts +7 -0
- package/src/commands/locale.js +7 -0
- package/src/core/accounts.d.ts +37 -0
- package/src/core/accounts.js +163 -0
- package/src/core/agent-config.d.ts +100 -0
- package/src/core/agent-config.js +139 -0
- package/src/core/api-error.d.ts +48 -0
- package/src/core/api-error.js +112 -0
- package/src/core/app-owner-fallback.d.ts +21 -0
- package/src/core/app-owner-fallback.js +38 -0
- package/src/core/app-scope-checker.d.ts +87 -0
- package/src/core/app-scope-checker.js +190 -0
- package/src/core/auth-errors.d.ts +144 -0
- package/src/core/auth-errors.js +154 -0
- package/src/core/chat-info-cache.d.ts +57 -0
- package/src/core/chat-info-cache.js +152 -0
- package/src/core/config-schema.d.ts +448 -0
- package/src/core/config-schema.js +200 -0
- package/src/core/device-flow.d.ts +77 -0
- package/src/core/device-flow.js +212 -0
- package/src/core/domains.d.ts +18 -0
- package/src/core/domains.js +28 -0
- package/src/core/feishu-fetch.d.ts +18 -0
- package/src/core/feishu-fetch.js +25 -0
- package/src/core/footer-config.d.ts +24 -0
- package/src/core/footer-config.js +39 -0
- package/src/core/lark-client.d.ts +108 -0
- package/src/core/lark-client.js +353 -0
- package/src/core/lark-logger.d.ts +23 -0
- package/src/core/lark-logger.js +154 -0
- package/src/core/lark-ticket.d.ts +29 -0
- package/src/core/lark-ticket.js +35 -0
- package/src/core/message-unavailable.d.ts +53 -0
- package/src/core/message-unavailable.js +130 -0
- package/src/core/owner-policy.d.ts +31 -0
- package/src/core/owner-policy.js +52 -0
- package/src/core/permission-url.d.ts +22 -0
- package/src/core/permission-url.js +72 -0
- package/src/core/raw-request.d.ts +27 -0
- package/src/core/raw-request.js +62 -0
- package/src/core/scope-manager.d.ts +168 -0
- package/src/core/scope-manager.js +213 -0
- package/src/core/security-check.d.ts +72 -0
- package/src/core/security-check.js +174 -0
- package/src/core/shutdown-hooks.d.ts +22 -0
- package/src/core/shutdown-hooks.js +56 -0
- package/src/core/targets.d.ts +60 -0
- package/src/core/targets.js +164 -0
- package/src/core/token-store.d.ts +54 -0
- package/src/core/token-store.js +314 -0
- package/src/core/tool-client.d.ts +176 -0
- package/src/core/tool-client.js +380 -0
- package/src/core/tool-scopes.d.ts +153 -0
- package/src/core/tool-scopes.js +326 -0
- package/src/core/tools-config.d.ts +55 -0
- package/src/core/tools-config.js +137 -0
- package/src/core/types.d.ts +87 -0
- package/src/core/types.js +11 -0
- package/src/core/uat-client.d.ts +46 -0
- package/src/core/uat-client.js +187 -0
- package/src/core/version.d.ts +25 -0
- package/src/core/version.js +49 -0
- package/src/messaging/converters/audio.d.ts +8 -0
- package/src/messaging/converters/audio.js +21 -0
- package/src/messaging/converters/calendar.d.ts +13 -0
- package/src/messaging/converters/calendar.js +50 -0
- package/src/messaging/converters/content-converter.d.ts +41 -0
- package/src/messaging/converters/content-converter.js +106 -0
- package/src/messaging/converters/file.d.ts +8 -0
- package/src/messaging/converters/file.js +20 -0
- package/src/messaging/converters/folder.d.ts +8 -0
- package/src/messaging/converters/folder.js +20 -0
- package/src/messaging/converters/hongbao.d.ts +8 -0
- package/src/messaging/converters/hongbao.js +16 -0
- package/src/messaging/converters/image.d.ts +8 -0
- package/src/messaging/converters/image.js +18 -0
- package/src/messaging/converters/index.d.ts +8 -0
- package/src/messaging/converters/index.js +50 -0
- package/src/messaging/converters/interactive/card-converter.d.ts +76 -0
- package/src/messaging/converters/interactive/card-converter.js +1173 -0
- package/src/messaging/converters/interactive/card-utils.d.ts +9 -0
- package/src/messaging/converters/interactive/card-utils.js +42 -0
- package/src/messaging/converters/interactive/index.d.ts +8 -0
- package/src/messaging/converters/interactive/index.js +21 -0
- package/src/messaging/converters/interactive/legacy.d.ts +11 -0
- package/src/messaging/converters/interactive/legacy.js +57 -0
- package/src/messaging/converters/interactive/types.d.ts +23 -0
- package/src/messaging/converters/interactive/types.js +24 -0
- package/src/messaging/converters/location.d.ts +8 -0
- package/src/messaging/converters/location.js +19 -0
- package/src/messaging/converters/merge-forward.d.ts +32 -0
- package/src/messaging/converters/merge-forward.js +225 -0
- package/src/messaging/converters/post.d.ts +11 -0
- package/src/messaging/converters/post.js +135 -0
- package/src/messaging/converters/share.d.ts +9 -0
- package/src/messaging/converters/share.js +23 -0
- package/src/messaging/converters/sticker.d.ts +8 -0
- package/src/messaging/converters/sticker.js +18 -0
- package/src/messaging/converters/system.d.ts +12 -0
- package/src/messaging/converters/system.js +32 -0
- package/src/messaging/converters/text.d.ts +8 -0
- package/src/messaging/converters/text.js +14 -0
- package/src/messaging/converters/todo.d.ts +8 -0
- package/src/messaging/converters/todo.js +41 -0
- package/src/messaging/converters/types.d.ts +107 -0
- package/src/messaging/converters/types.js +7 -0
- package/src/messaging/converters/unknown.d.ts +8 -0
- package/src/messaging/converters/unknown.js +16 -0
- package/src/messaging/converters/utils.d.ts +22 -0
- package/src/messaging/converters/utils.js +51 -0
- package/src/messaging/converters/video-chat.d.ts +8 -0
- package/src/messaging/converters/video-chat.js +23 -0
- package/src/messaging/converters/video.d.ts +8 -0
- package/src/messaging/converters/video.js +32 -0
- package/src/messaging/converters/vote.d.ts +8 -0
- package/src/messaging/converters/vote.js +24 -0
- package/src/messaging/inbound/dedup.d.ts +59 -0
- package/src/messaging/inbound/dedup.js +116 -0
- package/src/messaging/inbound/dispatch-builders.d.ts +84 -0
- package/src/messaging/inbound/dispatch-builders.js +152 -0
- package/src/messaging/inbound/dispatch-commands.d.ts +27 -0
- package/src/messaging/inbound/dispatch-commands.js +112 -0
- package/src/messaging/inbound/dispatch-context.d.ts +67 -0
- package/src/messaging/inbound/dispatch-context.js +136 -0
- package/src/messaging/inbound/dispatch.d.ts +47 -0
- package/src/messaging/inbound/dispatch.js +264 -0
- package/src/messaging/inbound/enrich.d.ts +102 -0
- package/src/messaging/inbound/enrich.js +227 -0
- package/src/messaging/inbound/gate-effects.d.ts +23 -0
- package/src/messaging/inbound/gate-effects.js +43 -0
- package/src/messaging/inbound/gate.d.ts +60 -0
- package/src/messaging/inbound/gate.js +233 -0
- package/src/messaging/inbound/handler.d.ts +35 -0
- package/src/messaging/inbound/handler.js +173 -0
- package/src/messaging/inbound/media-resolver.d.ts +32 -0
- package/src/messaging/inbound/media-resolver.js +87 -0
- package/src/messaging/inbound/mention.d.ts +39 -0
- package/src/messaging/inbound/mention.js +81 -0
- package/src/messaging/inbound/parse-io.d.ts +50 -0
- package/src/messaging/inbound/parse-io.js +81 -0
- package/src/messaging/inbound/parse.d.ts +28 -0
- package/src/messaging/inbound/parse.js +106 -0
- package/src/messaging/inbound/permission.d.ts +17 -0
- package/src/messaging/inbound/permission.js +40 -0
- package/src/messaging/inbound/policy.d.ts +94 -0
- package/src/messaging/inbound/policy.js +160 -0
- package/src/messaging/inbound/reaction-handler.d.ts +61 -0
- package/src/messaging/inbound/reaction-handler.js +221 -0
- package/src/messaging/inbound/user-name-cache.d.ts +82 -0
- package/src/messaging/inbound/user-name-cache.js +241 -0
- package/src/messaging/outbound/actions.d.ts +16 -0
- package/src/messaging/outbound/actions.js +309 -0
- package/src/messaging/outbound/chat-manage.d.ts +64 -0
- package/src/messaging/outbound/chat-manage.js +111 -0
- package/src/messaging/outbound/deliver.d.ts +155 -0
- package/src/messaging/outbound/deliver.js +298 -0
- package/src/messaging/outbound/fetch.d.ts +12 -0
- package/src/messaging/outbound/fetch.js +12 -0
- package/src/messaging/outbound/forward.d.ts +26 -0
- package/src/messaging/outbound/forward.js +48 -0
- package/src/messaging/outbound/media-url-utils.d.ts +29 -0
- package/src/messaging/outbound/media-url-utils.js +130 -0
- package/src/messaging/outbound/media.d.ts +260 -0
- package/src/messaging/outbound/media.js +758 -0
- package/src/messaging/outbound/outbound.d.ts +89 -0
- package/src/messaging/outbound/outbound.js +121 -0
- package/src/messaging/outbound/reactions.d.ts +124 -0
- package/src/messaging/outbound/reactions.js +378 -0
- package/src/messaging/outbound/send.d.ts +152 -0
- package/src/messaging/outbound/send.js +355 -0
- package/src/messaging/outbound/typing.d.ts +71 -0
- package/src/messaging/outbound/typing.js +179 -0
- package/src/messaging/shared/message-lookup.d.ts +54 -0
- package/src/messaging/shared/message-lookup.js +117 -0
- package/src/messaging/types.d.ts +176 -0
- package/src/messaging/types.js +10 -0
- package/src/tools/auto-auth.d.ts +56 -0
- package/src/tools/auto-auth.js +919 -0
- package/src/tools/helpers.d.ts +260 -0
- package/src/tools/helpers.js +364 -0
- package/src/tools/mcp/doc/create.d.ts +12 -0
- package/src/tools/mcp/doc/create.js +44 -0
- package/src/tools/mcp/doc/fetch.d.ts +12 -0
- package/src/tools/mcp/doc/fetch.js +36 -0
- package/src/tools/mcp/doc/index.d.ts +12 -0
- package/src/tools/mcp/doc/index.js +41 -0
- package/src/tools/mcp/doc/update.d.ts +12 -0
- package/src/tools/mcp/doc/update.js +61 -0
- package/src/tools/mcp/shared.d.ts +59 -0
- package/src/tools/mcp/shared.js +226 -0
- package/src/tools/oapi/bitable/app-table-field.d.ts +16 -0
- package/src/tools/oapi/bitable/app-table-field.js +222 -0
- package/src/tools/oapi/bitable/app-table-record.d.ts +20 -0
- package/src/tools/oapi/bitable/app-table-record.js +436 -0
- package/src/tools/oapi/bitable/app-table-view.d.ts +17 -0
- package/src/tools/oapi/bitable/app-table-view.js +195 -0
- package/src/tools/oapi/bitable/app-table.d.ts +19 -0
- package/src/tools/oapi/bitable/app-table.js +247 -0
- package/src/tools/oapi/bitable/app.d.ts +18 -0
- package/src/tools/oapi/bitable/app.js +186 -0
- package/src/tools/oapi/bitable/index.d.ts +9 -0
- package/src/tools/oapi/bitable/index.js +9 -0
- package/src/tools/oapi/calendar/calendar.d.ts +15 -0
- package/src/tools/oapi/calendar/calendar.js +122 -0
- package/src/tools/oapi/calendar/event-attendee.d.ts +16 -0
- package/src/tools/oapi/calendar/event-attendee.js +263 -0
- package/src/tools/oapi/calendar/event.d.ts +16 -0
- package/src/tools/oapi/calendar/event.js +709 -0
- package/src/tools/oapi/calendar/freebusy.d.ts +13 -0
- package/src/tools/oapi/calendar/freebusy.js +111 -0
- package/src/tools/oapi/calendar/index.d.ts +8 -0
- package/src/tools/oapi/calendar/index.js +8 -0
- package/src/tools/oapi/chat/chat.d.ts +16 -0
- package/src/tools/oapi/chat/chat.js +124 -0
- package/src/tools/oapi/chat/index.d.ts +10 -0
- package/src/tools/oapi/chat/index.js +15 -0
- package/src/tools/oapi/chat/members.d.ts +11 -0
- package/src/tools/oapi/chat/members.js +81 -0
- package/src/tools/oapi/common/get-user.d.ts +12 -0
- package/src/tools/oapi/common/get-user.js +106 -0
- package/src/tools/oapi/common/index.d.ts +6 -0
- package/src/tools/oapi/common/index.js +6 -0
- package/src/tools/oapi/common/search-user.d.ts +11 -0
- package/src/tools/oapi/common/search-user.js +73 -0
- package/src/tools/oapi/drive/doc-comments.d.ts +15 -0
- package/src/tools/oapi/drive/doc-comments.js +279 -0
- package/src/tools/oapi/drive/doc-media.d.ts +19 -0
- package/src/tools/oapi/drive/doc-media.js +335 -0
- package/src/tools/oapi/drive/file.d.ts +19 -0
- package/src/tools/oapi/drive/file.js +483 -0
- package/src/tools/oapi/drive/index.d.ts +12 -0
- package/src/tools/oapi/drive/index.js +36 -0
- package/src/tools/oapi/helpers.d.ts +182 -0
- package/src/tools/oapi/helpers.js +354 -0
- package/src/tools/oapi/im/format-messages.d.ts +50 -0
- package/src/tools/oapi/im/format-messages.js +165 -0
- package/src/tools/oapi/im/index.d.ts +10 -0
- package/src/tools/oapi/im/index.js +17 -0
- package/src/tools/oapi/im/message-read.d.ts +13 -0
- package/src/tools/oapi/im/message-read.js +411 -0
- package/src/tools/oapi/im/message.d.ts +16 -0
- package/src/tools/oapi/im/message.js +149 -0
- package/src/tools/oapi/im/resource.d.ts +13 -0
- package/src/tools/oapi/im/resource.js +150 -0
- package/src/tools/oapi/im/time-utils.d.ts +46 -0
- package/src/tools/oapi/im/time-utils.js +201 -0
- package/src/tools/oapi/im/user-name-uat.d.ts +26 -0
- package/src/tools/oapi/im/user-name-uat.js +140 -0
- package/src/tools/oapi/index.d.ts +11 -0
- package/src/tools/oapi/index.js +58 -0
- package/src/tools/oapi/sdk-types.d.ts +96 -0
- package/src/tools/oapi/sdk-types.js +12 -0
- package/src/tools/oapi/search/doc-search.d.ts +13 -0
- package/src/tools/oapi/search/doc-search.js +191 -0
- package/src/tools/oapi/search/index.d.ts +12 -0
- package/src/tools/oapi/search/index.js +33 -0
- package/src/tools/oapi/sheets/index.d.ts +12 -0
- package/src/tools/oapi/sheets/index.js +31 -0
- package/src/tools/oapi/sheets/sheet.d.ts +16 -0
- package/src/tools/oapi/sheets/sheet.js +652 -0
- package/src/tools/oapi/task/comment.d.ts +15 -0
- package/src/tools/oapi/task/comment.js +140 -0
- package/src/tools/oapi/task/index.d.ts +8 -0
- package/src/tools/oapi/task/index.js +8 -0
- package/src/tools/oapi/task/subtask.d.ts +14 -0
- package/src/tools/oapi/task/subtask.js +162 -0
- package/src/tools/oapi/task/task.d.ts +16 -0
- package/src/tools/oapi/task/task.js +344 -0
- package/src/tools/oapi/task/tasklist.d.ts +21 -0
- package/src/tools/oapi/task/tasklist.js +321 -0
- package/src/tools/oapi/wiki/index.d.ts +12 -0
- package/src/tools/oapi/wiki/index.js +34 -0
- package/src/tools/oapi/wiki/space-node.d.ts +17 -0
- package/src/tools/oapi/wiki/space-node.js +230 -0
- package/src/tools/oapi/wiki/space.d.ts +15 -0
- package/src/tools/oapi/wiki/space.js +130 -0
- package/src/tools/oauth-batch-auth.d.ts +11 -0
- package/src/tools/oauth-batch-auth.js +142 -0
- package/src/tools/oauth-cards.d.ts +39 -0
- package/src/tools/oauth-cards.js +315 -0
- package/src/tools/oauth.d.ts +47 -0
- package/src/tools/oauth.js +620 -0
- package/src/tools/onboarding-auth.d.ts +27 -0
- package/src/tools/onboarding-auth.js +130 -0
- package/src/tools/tat/im/index.d.ts +15 -0
- package/src/tools/tat/im/index.js +18 -0
- package/src/tools/tat/im/resource.d.ts +15 -0
- package/src/tools/tat/im/resource.js +157 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* Reaction management for the Lark/Feishu channel plugin.
|
|
6
|
+
*
|
|
7
|
+
* Provides functions to add, remove, and list emoji reactions on Feishu
|
|
8
|
+
* messages using the IM Message Reaction API.
|
|
9
|
+
*/
|
|
10
|
+
import { LarkClient } from '../../core/lark-client';
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Feishu emoji constants
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
/**
|
|
15
|
+
* Well-known Feishu emoji type strings.
|
|
16
|
+
*
|
|
17
|
+
* This is a convenience map so consumers do not need to memorise the
|
|
18
|
+
* exact string identifiers. It is intentionally non-exhaustive --
|
|
19
|
+
* Feishu supports many more emoji types. Any valid emoji type string
|
|
20
|
+
* can be passed directly to the API functions.
|
|
21
|
+
*/
|
|
22
|
+
export const FeishuEmoji = {
|
|
23
|
+
THUMBSUP: 'THUMBSUP',
|
|
24
|
+
THUMBSDOWN: 'THUMBSDOWN',
|
|
25
|
+
HEART: 'HEART',
|
|
26
|
+
SMILE: 'SMILE',
|
|
27
|
+
JOYFUL: 'JOYFUL',
|
|
28
|
+
FROWN: 'FROWN',
|
|
29
|
+
BLUSH: 'BLUSH',
|
|
30
|
+
OK: 'OK',
|
|
31
|
+
CLAP: 'CLAP',
|
|
32
|
+
FIREWORKS: 'FIREWORKS',
|
|
33
|
+
PARTY: 'PARTY',
|
|
34
|
+
MUSCLE: 'MUSCLE',
|
|
35
|
+
FIRE: 'FIRE',
|
|
36
|
+
EYES: 'EYES',
|
|
37
|
+
THINKING: 'THINKING',
|
|
38
|
+
PRAISE: 'PRAISE',
|
|
39
|
+
PRAY: 'PRAY',
|
|
40
|
+
ROCKET: 'ROCKET',
|
|
41
|
+
DONE: 'DONE',
|
|
42
|
+
SKULL: 'SKULL',
|
|
43
|
+
HUNDREDPOINTS: 'HUNDREDPOINTS',
|
|
44
|
+
FACEPALM: 'FACEPALM',
|
|
45
|
+
CHECK: 'CHECK',
|
|
46
|
+
CROSSMARK: 'CrossMark',
|
|
47
|
+
COOL: 'COOL',
|
|
48
|
+
TYPING: 'Typing',
|
|
49
|
+
SPEECHLESS: 'SPEECHLESS',
|
|
50
|
+
};
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Valid Feishu emoji types (complete set)
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
/**
|
|
55
|
+
* Complete set of valid Feishu emoji type strings for reactions.
|
|
56
|
+
*
|
|
57
|
+
* Sourced from the official Feishu emoji documentation.
|
|
58
|
+
* Unlike `FeishuEmoji` (a convenience subset), this set is exhaustive
|
|
59
|
+
* and can be used for validation and error reporting.
|
|
60
|
+
*
|
|
61
|
+
* @see https://go.feishu.cn/s/670vFWbA804
|
|
62
|
+
*/
|
|
63
|
+
export const VALID_FEISHU_EMOJI_TYPES = new Set([
|
|
64
|
+
// Gestures / actions
|
|
65
|
+
'OK',
|
|
66
|
+
'THUMBSUP',
|
|
67
|
+
'THANKS',
|
|
68
|
+
'MUSCLE',
|
|
69
|
+
'FINGERHEART',
|
|
70
|
+
'APPLAUSE',
|
|
71
|
+
'FISTBUMP',
|
|
72
|
+
'JIAYI',
|
|
73
|
+
'DONE',
|
|
74
|
+
// Faces / expressions
|
|
75
|
+
'SMILE',
|
|
76
|
+
'BLUSH',
|
|
77
|
+
'LAUGH',
|
|
78
|
+
'SMIRK',
|
|
79
|
+
'LOL',
|
|
80
|
+
'FACEPALM',
|
|
81
|
+
'LOVE',
|
|
82
|
+
'WINK',
|
|
83
|
+
'PROUD',
|
|
84
|
+
'WITTY',
|
|
85
|
+
'SMART',
|
|
86
|
+
'SCOWL',
|
|
87
|
+
'THINKING',
|
|
88
|
+
'SOB',
|
|
89
|
+
'CRY',
|
|
90
|
+
'ERROR',
|
|
91
|
+
'NOSEPICK',
|
|
92
|
+
'HAUGHTY',
|
|
93
|
+
'SLAP',
|
|
94
|
+
'SPITBLOOD',
|
|
95
|
+
'TOASTED',
|
|
96
|
+
'GLANCE',
|
|
97
|
+
'DULL',
|
|
98
|
+
'INNOCENTSMILE',
|
|
99
|
+
'JOYFUL',
|
|
100
|
+
'WOW',
|
|
101
|
+
'TRICK',
|
|
102
|
+
'YEAH',
|
|
103
|
+
'ENOUGH',
|
|
104
|
+
'TEARS',
|
|
105
|
+
'EMBARRASSED',
|
|
106
|
+
'KISS',
|
|
107
|
+
'SMOOCH',
|
|
108
|
+
'DROOL',
|
|
109
|
+
'OBSESSED',
|
|
110
|
+
'MONEY',
|
|
111
|
+
'TEASE',
|
|
112
|
+
'SHOWOFF',
|
|
113
|
+
'COMFORT',
|
|
114
|
+
'CLAP',
|
|
115
|
+
'PRAISE',
|
|
116
|
+
'STRIVE',
|
|
117
|
+
'XBLUSH',
|
|
118
|
+
'SILENT',
|
|
119
|
+
'WAVE',
|
|
120
|
+
'WHAT',
|
|
121
|
+
'FROWN',
|
|
122
|
+
'SHY',
|
|
123
|
+
'DIZZY',
|
|
124
|
+
'LOOKDOWN',
|
|
125
|
+
'CHUCKLE',
|
|
126
|
+
'WAIL',
|
|
127
|
+
'CRAZY',
|
|
128
|
+
'WHIMPER',
|
|
129
|
+
'HUG',
|
|
130
|
+
'BLUBBER',
|
|
131
|
+
'WRONGED',
|
|
132
|
+
'HUSKY',
|
|
133
|
+
'SHHH',
|
|
134
|
+
'SMUG',
|
|
135
|
+
'ANGRY',
|
|
136
|
+
'HAMMER',
|
|
137
|
+
'SHOCKED',
|
|
138
|
+
'TERROR',
|
|
139
|
+
'PETRIFIED',
|
|
140
|
+
'SKULL',
|
|
141
|
+
'SWEAT',
|
|
142
|
+
'SPEECHLESS',
|
|
143
|
+
'SLEEP',
|
|
144
|
+
'DROWSY',
|
|
145
|
+
'YAWN',
|
|
146
|
+
'SICK',
|
|
147
|
+
'PUKE',
|
|
148
|
+
'BETRAYED',
|
|
149
|
+
'HEADSET',
|
|
150
|
+
'EatingFood',
|
|
151
|
+
'MeMeMe',
|
|
152
|
+
'Sigh',
|
|
153
|
+
'Typing',
|
|
154
|
+
'SLIGHT',
|
|
155
|
+
'TONGUE',
|
|
156
|
+
'EYESCLOSED',
|
|
157
|
+
'RoarForYou',
|
|
158
|
+
'CALF',
|
|
159
|
+
'BEAR',
|
|
160
|
+
'BULL',
|
|
161
|
+
'RAINBOWPUKE',
|
|
162
|
+
// Objects / food / drinks
|
|
163
|
+
'Lemon',
|
|
164
|
+
'ROSE',
|
|
165
|
+
'HEART',
|
|
166
|
+
'PARTY',
|
|
167
|
+
'LIPS',
|
|
168
|
+
'BEER',
|
|
169
|
+
'CAKE',
|
|
170
|
+
'GIFT',
|
|
171
|
+
'CUCUMBER',
|
|
172
|
+
'Drumstick',
|
|
173
|
+
'Pepper',
|
|
174
|
+
'CANDIEDHAWS',
|
|
175
|
+
'BubbleTea',
|
|
176
|
+
'Coffee',
|
|
177
|
+
// Symbols / marks
|
|
178
|
+
'Get',
|
|
179
|
+
'LGTM',
|
|
180
|
+
'OnIt',
|
|
181
|
+
'OneSecond',
|
|
182
|
+
'VRHeadset',
|
|
183
|
+
'YouAreTheBest',
|
|
184
|
+
'SALUTE',
|
|
185
|
+
'SHAKE',
|
|
186
|
+
'HIGHFIVE',
|
|
187
|
+
'UPPERLEFT',
|
|
188
|
+
'ThumbsDown',
|
|
189
|
+
'Yes',
|
|
190
|
+
'No',
|
|
191
|
+
'OKR',
|
|
192
|
+
'CheckMark',
|
|
193
|
+
'CrossMark',
|
|
194
|
+
'MinusOne',
|
|
195
|
+
'Hundred',
|
|
196
|
+
'AWESOMEN',
|
|
197
|
+
'Pin',
|
|
198
|
+
'Alarm',
|
|
199
|
+
'Loudspeaker',
|
|
200
|
+
'Trophy',
|
|
201
|
+
'Fire',
|
|
202
|
+
'BOMB',
|
|
203
|
+
'Music',
|
|
204
|
+
// Holidays / seasons
|
|
205
|
+
'XmasTree',
|
|
206
|
+
'Snowman',
|
|
207
|
+
'XmasHat',
|
|
208
|
+
'FIREWORKS',
|
|
209
|
+
'2022',
|
|
210
|
+
'REDPACKET',
|
|
211
|
+
'FORTUNE',
|
|
212
|
+
'LUCK',
|
|
213
|
+
'FIRECRACKER',
|
|
214
|
+
'StickyRiceBalls',
|
|
215
|
+
// Miscellaneous
|
|
216
|
+
'HEARTBROKEN',
|
|
217
|
+
'POOP',
|
|
218
|
+
'StatusFlashOfInspiration',
|
|
219
|
+
'18X',
|
|
220
|
+
'CLEAVER',
|
|
221
|
+
'Soccer',
|
|
222
|
+
'Basketball',
|
|
223
|
+
// Status
|
|
224
|
+
'GeneralDoNotDisturb',
|
|
225
|
+
'Status_PrivateMessage',
|
|
226
|
+
'GeneralInMeetingBusy',
|
|
227
|
+
'StatusReading',
|
|
228
|
+
'StatusInFlight',
|
|
229
|
+
'GeneralBusinessTrip',
|
|
230
|
+
'GeneralWorkFromHome',
|
|
231
|
+
'StatusEnjoyLife',
|
|
232
|
+
'GeneralTravellingCar',
|
|
233
|
+
'StatusBus',
|
|
234
|
+
'GeneralSun',
|
|
235
|
+
'GeneralMoonRest',
|
|
236
|
+
// Holiday extras
|
|
237
|
+
'MoonRabbit',
|
|
238
|
+
'Mooncake',
|
|
239
|
+
'JubilantRabbit',
|
|
240
|
+
'TV',
|
|
241
|
+
'Movie',
|
|
242
|
+
'Pumpkin',
|
|
243
|
+
// Newer additions
|
|
244
|
+
'BeamingFace',
|
|
245
|
+
'Delighted',
|
|
246
|
+
'ColdSweat',
|
|
247
|
+
'FullMoonFace',
|
|
248
|
+
'Partying',
|
|
249
|
+
'GoGoGo',
|
|
250
|
+
'ThanksFace',
|
|
251
|
+
'SaluteFace',
|
|
252
|
+
'Shrug',
|
|
253
|
+
'ClownFace',
|
|
254
|
+
'HappyDragon',
|
|
255
|
+
]);
|
|
256
|
+
// ---------------------------------------------------------------------------
|
|
257
|
+
// addReactionFeishu
|
|
258
|
+
// ---------------------------------------------------------------------------
|
|
259
|
+
/**
|
|
260
|
+
* Add an emoji reaction to a Feishu message.
|
|
261
|
+
*
|
|
262
|
+
* @param params.cfg - Plugin configuration with Feishu credentials.
|
|
263
|
+
* @param params.messageId - The message to react to.
|
|
264
|
+
* @param params.emojiType - The emoji type string (e.g. "THUMBSUP").
|
|
265
|
+
* @param params.accountId - Optional account identifier for multi-account setups.
|
|
266
|
+
* @returns An object containing the platform-assigned reaction ID.
|
|
267
|
+
*/
|
|
268
|
+
export async function addReactionFeishu(params) {
|
|
269
|
+
const { cfg, messageId, emojiType, accountId } = params;
|
|
270
|
+
const client = LarkClient.fromCfg(cfg, accountId).sdk;
|
|
271
|
+
let response;
|
|
272
|
+
try {
|
|
273
|
+
response = await client.im.messageReaction.create({
|
|
274
|
+
path: {
|
|
275
|
+
message_id: messageId,
|
|
276
|
+
},
|
|
277
|
+
data: {
|
|
278
|
+
reaction_type: {
|
|
279
|
+
emoji_type: emojiType,
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
catch (err) {
|
|
285
|
+
const e = err;
|
|
286
|
+
const errCode = e.code ?? e.response?.data?.code;
|
|
287
|
+
if (errCode === 231001) {
|
|
288
|
+
const validTypes = Array.from(VALID_FEISHU_EMOJI_TYPES).join(', ');
|
|
289
|
+
throw new Error(`Emoji type "${emojiType}" is not a valid Feishu reaction. Valid types: ${validTypes}`);
|
|
290
|
+
}
|
|
291
|
+
throw err;
|
|
292
|
+
}
|
|
293
|
+
const reactionId = response?.data?.reaction_id;
|
|
294
|
+
if (!reactionId) {
|
|
295
|
+
throw new Error(`[feishu-reactions] Failed to add reaction "${emojiType}" to message ${messageId}: no reaction_id returned`);
|
|
296
|
+
}
|
|
297
|
+
return { reactionId };
|
|
298
|
+
}
|
|
299
|
+
// ---------------------------------------------------------------------------
|
|
300
|
+
// removeReactionFeishu
|
|
301
|
+
// ---------------------------------------------------------------------------
|
|
302
|
+
/**
|
|
303
|
+
* Remove a specific reaction from a Feishu message by its reaction ID.
|
|
304
|
+
*
|
|
305
|
+
* Unlike the outbound module's `removeReaction` (which looks up the
|
|
306
|
+
* reaction by emoji type), this function takes the exact reaction ID
|
|
307
|
+
* for direct deletion.
|
|
308
|
+
*
|
|
309
|
+
* @param params.cfg - Plugin configuration with Feishu credentials.
|
|
310
|
+
* @param params.messageId - The message the reaction belongs to.
|
|
311
|
+
* @param params.reactionId - The platform-assigned reaction ID to delete.
|
|
312
|
+
* @param params.accountId - Optional account identifier for multi-account setups.
|
|
313
|
+
*/
|
|
314
|
+
export async function removeReactionFeishu(params) {
|
|
315
|
+
const { cfg, messageId, reactionId, accountId } = params;
|
|
316
|
+
const client = LarkClient.fromCfg(cfg, accountId).sdk;
|
|
317
|
+
await client.im.messageReaction.delete({
|
|
318
|
+
path: {
|
|
319
|
+
message_id: messageId,
|
|
320
|
+
reaction_id: reactionId,
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
// ---------------------------------------------------------------------------
|
|
325
|
+
// listReactionsFeishu
|
|
326
|
+
// ---------------------------------------------------------------------------
|
|
327
|
+
/**
|
|
328
|
+
* List reactions on a Feishu message, optionally filtered by emoji type.
|
|
329
|
+
*
|
|
330
|
+
* Paginates through all results and returns a flat array of
|
|
331
|
+
* {@link FeishuReaction} objects.
|
|
332
|
+
*
|
|
333
|
+
* @param params.cfg - Plugin configuration with Feishu credentials.
|
|
334
|
+
* @param params.messageId - The message whose reactions to list.
|
|
335
|
+
* @param params.emojiType - Optional emoji type filter (e.g. "THUMBSUP").
|
|
336
|
+
* When omitted, all reaction types are returned.
|
|
337
|
+
* @param params.accountId - Optional account identifier for multi-account setups.
|
|
338
|
+
* @returns An array of reactions matching the criteria.
|
|
339
|
+
*/
|
|
340
|
+
export async function listReactionsFeishu(params) {
|
|
341
|
+
const { cfg, messageId, emojiType, accountId } = params;
|
|
342
|
+
const client = LarkClient.fromCfg(cfg, accountId).sdk;
|
|
343
|
+
const reactions = [];
|
|
344
|
+
let pageToken;
|
|
345
|
+
let hasMore = true;
|
|
346
|
+
while (hasMore) {
|
|
347
|
+
const requestParams = {
|
|
348
|
+
page_size: 50,
|
|
349
|
+
};
|
|
350
|
+
if (emojiType) {
|
|
351
|
+
requestParams.reaction_type = emojiType;
|
|
352
|
+
}
|
|
353
|
+
if (pageToken) {
|
|
354
|
+
requestParams.page_token = pageToken;
|
|
355
|
+
}
|
|
356
|
+
const response = await client.im.messageReaction.list({
|
|
357
|
+
path: {
|
|
358
|
+
message_id: messageId,
|
|
359
|
+
},
|
|
360
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
361
|
+
params: requestParams,
|
|
362
|
+
});
|
|
363
|
+
const items = response?.data?.items;
|
|
364
|
+
if (items && items.length > 0) {
|
|
365
|
+
for (const item of items) {
|
|
366
|
+
reactions.push({
|
|
367
|
+
reactionId: item.reaction_id ?? '',
|
|
368
|
+
emojiType: item.reaction_type?.emoji_type ?? '',
|
|
369
|
+
operatorType: item.operator?.operator_type === 'app' ? 'app' : 'user',
|
|
370
|
+
operatorId: item.operator?.operator_id ?? '',
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
pageToken = response?.data?.page_token ?? undefined;
|
|
375
|
+
hasMore = response?.data?.has_more === true && !!pageToken;
|
|
376
|
+
}
|
|
377
|
+
return reactions;
|
|
378
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*
|
|
5
|
+
* Message sending for the Lark/Feishu channel plugin.
|
|
6
|
+
*/
|
|
7
|
+
import type { ClawdbotConfig } from 'openclaw/plugin-sdk';
|
|
8
|
+
import type { FeishuSendResult } from '../types';
|
|
9
|
+
import type { MentionInfo } from '../types';
|
|
10
|
+
/**
|
|
11
|
+
* Parameters for sending a text / post message.
|
|
12
|
+
*/
|
|
13
|
+
export interface SendFeishuMessageParams {
|
|
14
|
+
cfg: ClawdbotConfig;
|
|
15
|
+
/** Target identifier (chat_id, open_id, or user_id). */
|
|
16
|
+
to: string;
|
|
17
|
+
/** Message text content (supports Feishu markdown subset). */
|
|
18
|
+
text: string;
|
|
19
|
+
/** When set, the message is sent as a threaded reply. */
|
|
20
|
+
replyToMessageId?: string;
|
|
21
|
+
/** Optional mention targets to prepend to the message. */
|
|
22
|
+
mentions?: MentionInfo[];
|
|
23
|
+
/** Optional account identifier for multi-account setups. */
|
|
24
|
+
accountId?: string;
|
|
25
|
+
/** When true, the reply appears in the thread instead of main chat. */
|
|
26
|
+
replyInThread?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Optional multi-locale texts for i18n post messages.
|
|
29
|
+
* When provided, builds a multi-locale post structure (e.g. { zh_cn: ..., en_us: ... })
|
|
30
|
+
* and the `text` field is ignored. Feishu client auto-selects locale based on user language.
|
|
31
|
+
*/
|
|
32
|
+
i18nTexts?: Record<string, string>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Parameters for sending an interactive card message.
|
|
36
|
+
*/
|
|
37
|
+
export interface SendFeishuCardParams {
|
|
38
|
+
cfg: ClawdbotConfig;
|
|
39
|
+
/** Target identifier (chat_id, open_id, or user_id). */
|
|
40
|
+
to: string;
|
|
41
|
+
/** The full interactive card JSON payload. */
|
|
42
|
+
card: Record<string, unknown>;
|
|
43
|
+
/** When set, the card is sent as a threaded reply. */
|
|
44
|
+
replyToMessageId?: string;
|
|
45
|
+
/** Optional account identifier for multi-account setups. */
|
|
46
|
+
accountId?: string;
|
|
47
|
+
/** When true, the reply appears in the thread instead of main chat. */
|
|
48
|
+
replyInThread?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Send a text message (rendered as a Feishu "post" with markdown support)
|
|
52
|
+
* to a chat or user.
|
|
53
|
+
*
|
|
54
|
+
* The message text is wrapped in Feishu's post format using the `md` tag
|
|
55
|
+
* for rich rendering. If `replyToMessageId` is provided, the message is
|
|
56
|
+
* sent as a threaded reply; otherwise it is sent as a new message using
|
|
57
|
+
* the appropriate `receive_id_type`.
|
|
58
|
+
*
|
|
59
|
+
* Markdown tables in the text are automatically converted to the format
|
|
60
|
+
* supported by Feishu via the runtime's table converter when available.
|
|
61
|
+
*
|
|
62
|
+
* @param params - See {@link SendFeishuMessageParams}.
|
|
63
|
+
* @returns The send result containing the new message ID.
|
|
64
|
+
*/
|
|
65
|
+
export declare function sendMessageFeishu(params: SendFeishuMessageParams): Promise<FeishuSendResult>;
|
|
66
|
+
/**
|
|
67
|
+
* Send an interactive card message to a chat or user.
|
|
68
|
+
*
|
|
69
|
+
* @param params - See {@link SendFeishuCardParams}.
|
|
70
|
+
* @returns The send result containing the new message ID.
|
|
71
|
+
*/
|
|
72
|
+
export declare function sendCardFeishu(params: SendFeishuCardParams): Promise<FeishuSendResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Update (PATCH) the content of an existing interactive card message.
|
|
75
|
+
*
|
|
76
|
+
* Only messages originally sent by the bot can be updated. The card
|
|
77
|
+
* must have been created with `"update_multi": true` in its config if
|
|
78
|
+
* all recipients should see the update.
|
|
79
|
+
*
|
|
80
|
+
* @param params.cfg - Plugin configuration.
|
|
81
|
+
* @param params.messageId - The card message ID to update.
|
|
82
|
+
* @param params.card - The new card content.
|
|
83
|
+
* @param params.accountId - Optional account identifier.
|
|
84
|
+
*/
|
|
85
|
+
export declare function updateCardFeishu(params: {
|
|
86
|
+
cfg: ClawdbotConfig;
|
|
87
|
+
messageId: string;
|
|
88
|
+
card: Record<string, unknown>;
|
|
89
|
+
accountId?: string;
|
|
90
|
+
}): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Build a simple Feishu Interactive Message Card containing a single
|
|
93
|
+
* markdown element.
|
|
94
|
+
*
|
|
95
|
+
* This is a convenience wrapper for the most common card layout: a
|
|
96
|
+
* wide-screen card with one markdown block.
|
|
97
|
+
*
|
|
98
|
+
* @param text - The markdown text to render in the card.
|
|
99
|
+
* @returns A card JSON object ready to be sent via {@link sendCardFeishu}.
|
|
100
|
+
*/
|
|
101
|
+
export declare function buildMarkdownCard(text: string): Record<string, unknown>;
|
|
102
|
+
/**
|
|
103
|
+
* Build an i18n-aware Feishu Interactive Message Card containing a single
|
|
104
|
+
* markdown element with per-locale content.
|
|
105
|
+
*
|
|
106
|
+
* Uses the CardKit v2 `i18n_content` field so the Feishu client
|
|
107
|
+
* auto-selects the locale matching the user's language setting.
|
|
108
|
+
*
|
|
109
|
+
* @param i18nTexts - A map of locale to markdown text (e.g. { zh_cn: '...', en_us: '...' }).
|
|
110
|
+
* @returns A card JSON object ready to be sent via {@link sendCardFeishu}.
|
|
111
|
+
*/
|
|
112
|
+
export declare function buildI18nMarkdownCard(i18nTexts: Record<string, string>): Record<string, unknown>;
|
|
113
|
+
/**
|
|
114
|
+
* Build a markdown card and send it in one step.
|
|
115
|
+
*
|
|
116
|
+
* If mention targets are provided, they are prepended to the markdown
|
|
117
|
+
* content using the card mention syntax.
|
|
118
|
+
*
|
|
119
|
+
* @param params.cfg - Plugin configuration.
|
|
120
|
+
* @param params.to - Target identifier.
|
|
121
|
+
* @param params.text - Markdown content for the card.
|
|
122
|
+
* @param params.replyToMessageId - Optional message ID for threaded reply.
|
|
123
|
+
* @param params.mentions - Optional mention targets.
|
|
124
|
+
* @param params.accountId - Optional account identifier.
|
|
125
|
+
* @returns The send result containing the new message ID.
|
|
126
|
+
*/
|
|
127
|
+
export declare function sendMarkdownCardFeishu(params: {
|
|
128
|
+
cfg: ClawdbotConfig;
|
|
129
|
+
to: string;
|
|
130
|
+
text: string;
|
|
131
|
+
replyToMessageId?: string;
|
|
132
|
+
mentions?: MentionInfo[];
|
|
133
|
+
accountId?: string;
|
|
134
|
+
replyInThread?: boolean;
|
|
135
|
+
}): Promise<FeishuSendResult>;
|
|
136
|
+
/**
|
|
137
|
+
* Edit the content of an existing message.
|
|
138
|
+
*
|
|
139
|
+
* Updates the message body via the IM message update API. Only
|
|
140
|
+
* messages sent by the bot can be edited.
|
|
141
|
+
*
|
|
142
|
+
* @param params.cfg - Plugin configuration.
|
|
143
|
+
* @param params.messageId - The message ID to edit.
|
|
144
|
+
* @param params.text - The new message text.
|
|
145
|
+
* @param params.accountId - Optional account identifier.
|
|
146
|
+
*/
|
|
147
|
+
export declare function editMessageFeishu(params: {
|
|
148
|
+
cfg: ClawdbotConfig;
|
|
149
|
+
messageId: string;
|
|
150
|
+
text: string;
|
|
151
|
+
accountId?: string;
|
|
152
|
+
}): Promise<void>;
|