From b4e5aa18b3b795b9ff13efbda12c8ab260811ff7 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Thu, 18 Jun 2026 11:02:00 +0800 Subject: [PATCH] refactor(feishu): remove unused send helpers --- extensions/feishu/src/accounts.ts | 6 ------ extensions/feishu/src/mention.ts | 19 ------------------- extensions/feishu/src/send.ts | 25 ------------------------- 3 files changed, 50 deletions(-) diff --git a/extensions/feishu/src/accounts.ts b/extensions/feishu/src/accounts.ts index cb531285277..bebd59f8e43 100644 --- a/extensions/feishu/src/accounts.ts +++ b/extensions/feishu/src/accounts.ts @@ -53,12 +53,6 @@ export class FeishuSecretRefUnavailableError extends Error { } } -export function isFeishuSecretRefUnavailableError( - error: unknown, -): error is FeishuSecretRefUnavailableError { - return error instanceof FeishuSecretRefUnavailableError; -} - function resolveFeishuSecretLike(params: { value: unknown; path: string; diff --git a/extensions/feishu/src/mention.ts b/extensions/feishu/src/mention.ts index 9f1e7f7eac2..5a567e3e32c 100644 --- a/extensions/feishu/src/mention.ts +++ b/extensions/feishu/src/mention.ts @@ -76,13 +76,6 @@ export function isMentionForwardRequest(event: FeishuMessageEvent, botOpenId?: s return hasBotMention && hasOtherMention; } -/** - * Format @mention for text message - */ -function formatMentionForText(target: MentionTarget): string { - return `${target.name}`; -} - /** * Format @mention for card message (lark_md) */ @@ -90,18 +83,6 @@ function formatMentionForCard(target: MentionTarget): string { return ``; } -/** - * Build complete message with @mentions (text format) - */ -export function buildMentionedMessage(targets: MentionTarget[], message: string): string { - if (targets.length === 0) { - return message; - } - - const mentionParts = targets.map((t) => formatMentionForText(t)); - return `${mentionParts.join(" ")} ${message}`; -} - /** * Build card content with @mentions (Markdown format) */ diff --git a/extensions/feishu/src/send.ts b/extensions/feishu/src/send.ts index 45309bf1623..2da1319bead 100644 --- a/extensions/feishu/src/send.ts +++ b/extensions/feishu/src/send.ts @@ -715,31 +715,6 @@ export async function editMessageFeishu(params: { return { messageId, contentType: "post" }; } -export async function updateCardFeishu(params: { - cfg: ClawdbotConfig; - messageId: string; - card: Record; - accountId?: string; -}): Promise { - const { cfg, messageId, card, accountId } = params; - const account = resolveFeishuRuntimeAccount({ cfg, accountId }); - if (!account.configured) { - throw new Error(`Feishu account "${account.accountId}" not configured`); - } - - const client = createFeishuClient(account); - const content = JSON.stringify(card); - - const response = await client.im.message.patch({ - path: { message_id: messageId }, - data: { content }, - }); - - if (response.code !== 0) { - throw new Error(`Feishu card update failed: ${response.msg || `code ${response.code}`}`); - } -} - /** * Build a Feishu interactive card with markdown content. * Cards render markdown properly (code blocks, tables, links, etc.)