mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-22 10:18:15 +00:00
refactor(feishu): remove unused send helpers
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 `<at user_id="${target.openId}">${target.name}</at>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format @mention for card message (lark_md)
|
||||
*/
|
||||
@@ -90,18 +83,6 @@ function formatMentionForCard(target: MentionTarget): string {
|
||||
return `<at id=${target.openId}></at>`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
|
||||
@@ -715,31 +715,6 @@ export async function editMessageFeishu(params: {
|
||||
return { messageId, contentType: "post" };
|
||||
}
|
||||
|
||||
export async function updateCardFeishu(params: {
|
||||
cfg: ClawdbotConfig;
|
||||
messageId: string;
|
||||
card: Record<string, unknown>;
|
||||
accountId?: string;
|
||||
}): Promise<void> {
|
||||
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.)
|
||||
|
||||
Reference in New Issue
Block a user