From a78df4a1a30766481b972fb40546d53ccff60ca4 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 02:02:13 +0100 Subject: [PATCH] refactor: remove unused qqbot sender helpers --- .../qqbot/src/engine/messaging/sender.ts | 73 ------------------- 1 file changed, 73 deletions(-) diff --git a/extensions/qqbot/src/engine/messaging/sender.ts b/extensions/qqbot/src/engine/messaging/sender.ts index 356eae120e5..6ac94cae63e 100644 --- a/extensions/qqbot/src/engine/messaging/sender.ts +++ b/extensions/qqbot/src/engine/messaging/sender.ts @@ -220,26 +220,6 @@ export function getMessageApi(appId: string): MessageApiClass { return resolveAccount(appId).messageApi; } -/** Get the MediaApi instance for the given appId. */ -export function getMediaApi(appId: string): MediaApiClass { - return resolveAccount(appId).mediaApi; -} - -/** Get the ChunkedMediaApi instance for the given appId. */ -export function getChunkedMediaApi(appId: string): ChunkedMediaApiClass { - return resolveAccount(appId).chunkedMediaApi; -} - -/** Get the TokenManager instance for the given appId. */ -export function getTokenManager(appId: string): TokenManager { - return resolveAccount(appId).tokenMgr; -} - -/** Get the ApiClient instance for the given appId. */ -export function getApiClient(appId: string): ApiClient { - return resolveAccount(appId).client; -} - // ============ Per-appId config ============ type OnMessageSentCallback = (refIdx: string, meta: OutboundMeta) => void; @@ -249,11 +229,6 @@ export function onMessageSent(appId: string, callback: OnMessageSentCallback): v resolveAccount(appId).messageApi.onMessageSent(callback); } -/** Return whether markdown is enabled for the given appId. */ -export function isMarkdownSupport(appId: string): boolean { - return _accountRegistry.get(appId.trim())?.markdownSupport ?? false; -} - // ============ Token management ============ export async function getAccessToken(appId: string, clientSecret: string): Promise { @@ -270,13 +245,6 @@ export function clearTokenCache(appId?: string): void { } } -export function getTokenStatus(appId: string): { - status: "valid" | "expired" | "refreshing" | "none"; - expiresAt: number | null; -} { - return resolveAccount(appId).tokenMgr.getStatus(appId); -} - export function startBackgroundTokenRefresh( appId: string, clientSecret: string, @@ -305,18 +273,6 @@ export function stopBackgroundTokenRefresh(appId?: string): void { } } -export function isBackgroundTokenRefreshRunning(appId?: string): boolean { - if (appId) { - return resolveAccount(appId).tokenMgr.isBackgroundRefreshRunning(appId); - } - for (const ctx of _accountRegistry.values()) { - if (ctx.tokenMgr.isBackgroundRefreshRunning()) { - return true; - } - } - return false; -} - // ============ Gateway URL ============ export async function getGatewayUrl(accessToken: string, appId: string): Promise { @@ -450,35 +406,6 @@ export async function sendText( return api.sendChannelMessage({ channelId: target.id, content, creds: c, msgId: opts?.msgId }); } -/** - * Send text with automatic token-retry. - */ -export async function sendTextWithRetry( - target: DeliveryTarget, - content: string, - creds: AccountCreds, - opts?: { msgId?: string; messageReference?: string }, - log?: EngineLogger, -): Promise { - return withTokenRetry( - creds, - async () => sendText(target, content, creds, opts), - log, - creds.appId, - ); -} - -/** - * Send a proactive text message (no msgId). - */ -export async function sendProactiveText( - target: DeliveryTarget, - content: string, - creds: AccountCreds, -): Promise { - return sendText(target, content, creds); -} - // ============ Input notify ============ /**