refactor: remove unused qqbot sender helpers

This commit is contained in:
Peter Steinberger
2026-05-02 02:02:13 +01:00
parent a29b440f06
commit a78df4a1a3

View File

@@ -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<string> {
@@ -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<string> {
@@ -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<MessageResponse> {
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<MessageResponse> {
return sendText(target, content, creds);
}
// ============ Input notify ============
/**