refactor(api): move 4 misc methods to MiscApi (#6 commit 10/13)

Inlines `actions/misc.ts` into `apis/misc.ts::MiscApi`. The Api holds
the methods that didn't naturally group into any other area:
translation, mini-app ARK card builder, inline-keyboard callback,
group sign-in.

No renaming — these names are already descriptive at the call site
under `apis.misc.X`.

Callers updated: `actions/extended.ts` (4 sites).
Tests rewritten to use `new MiscApi(bridge as any).method(...)`.

587/587 tests pass.
This commit is contained in:
DrSmoothl committed 2026-05-20 23:35:37 +08:00
1 parent d953b9824c
commit e5ac2a61b1
7 files changed
+168 -188

No files matched your search

+3 -18
View File
@@ -35,12 +35,7 @@ import type { GroupFilesResult } from './apis/group-file';
// were absorbed into MessageApi back in commit 1.
// actions/interaction.ts removed — sendPoke/sendLike/setReaction/
// getEmojiLikes moved to apis/interaction.ts::InteractionApi.
import {
clickInlineKeyboardButton as clickInlineKeyboardButton_,
getMiniAppArk as getMiniAppArk_,
sendGroupSign as sendGroupSign_,
translateEn2Zh as translateEn2Zh_,
} from './actions/misc';
// actions/misc.ts removed — moved to apis/misc.ts::MiscApi.
// actions/profile.ts removed — moved to apis/profile.ts::ProfileApi.
// `bridge-contacts.ts` removed — its 6 functions are now methods on
// `apis.contacts` (see `apis/contacts.ts::ContactsApi`).
@@ -344,18 +339,8 @@ export class Bridge implements BridgeInterface {
async getCookiesStr(domain: string): Promise<string> { return getCookiesStr_(this, domain); }
async getCsrfToken(): Promise<number> { return getCsrfToken_(this); }
async getCredentials(domain: string) { return getCredentials_(this, domain); }
async translateEn2Zh(words: string[]) {
return translateEn2Zh_(this, words);
}
async getMiniAppArk(type: string, title: string, desc: string, picUrl: string, jumpUrl: string) {
return getMiniAppArk_(this, type, title, desc, picUrl, jumpUrl);
}
async clickInlineKeyboardButton(groupId: number, botAppid: number, buttonId: string, callbackData: string, msgSeq: number) {
return clickInlineKeyboardButton_(this, groupId, botAppid, buttonId, callbackData, msgSeq);
}
async sendGroupSign(groupId: number) {
return sendGroupSign_(this, groupId);
}
// Misc methods (translateEn2Zh / getMiniAppArk /
// clickInlineKeyboardButton / sendGroupSign) moved to apis.misc.
// --- Tier-2 napcat-parity extras (group todo, stranger status, AI voice) ---