refactor: prune unused channel helpers

This commit is contained in:
Peter Steinberger
2026-05-01 09:31:04 +01:00
parent 067375cee3
commit 111432a7a6
7 changed files with 0 additions and 76 deletions

View File

@@ -1,5 +1,4 @@
import {
asOptionalRecord,
hasNonEmptyString as sharedHasNonEmptyString,
isRecord as sharedIsRecord,
normalizeOptionalString,
@@ -25,8 +24,6 @@ export const normalizeString = normalizeOptionalString;
export const isRecord = sharedIsRecord;
export const asRecord = asOptionalRecord;
export const hasNonEmptyString = sharedHasNonEmptyString;
export function formatFeishuApiError(
@@ -359,10 +356,6 @@ export function parseCommentContentElements(params: {
};
}
export function extractCommentElementText(element: unknown): string | undefined {
return parseCommentContentElements({ elements: [element] }).plainText;
}
export function extractReplyText(
reply: { content?: { elements?: unknown[] } } | undefined,
): string | undefined {

View File

@@ -83,20 +83,6 @@ export function isMentionForwardRequest(event: FeishuMessageEvent, botOpenId?: s
return hasBotMention && hasOtherMention;
}
/**
* Extract message body from text (remove @ placeholders)
*/
export function extractMessageBody(text: string, allMentionKeys: string[]): string {
let result = text;
// Remove all @ placeholders
for (const key of allMentionKeys) {
result = result.replace(new RegExp(escapeRegExp(key), "g"), "");
}
return result.replace(/\s+/g, " ").trim();
}
/**
* Format @mention for text message
*/
@@ -104,13 +90,6 @@ export function formatMentionForText(target: MentionTarget): string {
return `<at user_id="${target.openId}">${target.name}</at>`;
}
/**
* Format @everyone for text message
*/
export function formatMentionAllForText(): string {
return `<at user_id="all">Everyone</at>`;
}
/**
* Format @mention for card message (lark_md)
*/
@@ -118,13 +97,6 @@ export function formatMentionForCard(target: MentionTarget): string {
return `<at id=${target.openId}></at>`;
}
/**
* Format @everyone for card message
*/
export function formatMentionAllForCard(): string {
return `<at id=all></at>`;
}
/**
* Build complete message with @mentions (text format)
*/

View File

@@ -72,11 +72,3 @@ export async function fetchBotIdentityForMonitor(
}
return {};
}
export async function fetchBotOpenIdForMonitor(
account: ResolvedFeishuAccount,
options: FetchBotOpenIdOptions = {},
): Promise<string | undefined> {
const identity = await fetchBotIdentityForMonitor(account, options);
return identity.botOpenId;
}

View File

@@ -53,17 +53,6 @@ export function normalizeFeishuTarget(raw: string): string | null {
return withoutProvider;
}
export function formatFeishuTarget(id: string, type?: FeishuIdType): string {
const trimmed = id.trim();
if (type === "chat_id" || trimmed.startsWith(CHAT_ID_PREFIX)) {
return `chat:${trimmed}`;
}
if (type === "open_id" || trimmed.startsWith(OPEN_ID_PREFIX)) {
return `user:${trimmed}`;
}
return trimmed;
}
export function resolveReceiveIdType(id: string): "chat_id" | "open_id" | "user_id" {
const trimmed = id.trim();
const lowered = normalizeLowercaseStringOrEmpty(trimmed);