refactor(api): move Tier-2 extras to ExtrasApi (#6 commit 11/13)
Inlines `actions/extras.ts` into `apis/extras.ts::ExtrasApi`. Covers
the napcat-parity Tier-2 surface: group todo CRUD (0xF90_1/2/3),
stranger online/ext status decode (0xFE1_2), and AI voice list +
synthesis (0x929D / 0x929B).
`StrangerStatus`, `AiVoiceChatType`, `AiVoiceCategory`, `AiVoiceItem`
are now exported from `apis/extras.ts` and re-exported through
`bridge.ts` for backwards compatibility (the OneBot side imports
them via `@snowluma/core`).
No renaming — the names already read cleanly under `apis.extras.X`.
The `fetchAiVoiceList` / `fetchAiVoice` chatType parameter is widened
to `AiVoiceChatType | number` because the OneBot side passes a raw
number from JSON. The wire encoder is happy with any integer; the
strict enum just gives autocompletion at call sites that have it.
Callers updated: `actions/extended.ts` (7 sites).
Tests rewritten:
- `extras.test.ts` → uses `new ExtrasApi(bridge as any).method(...)`
and the it.each dispatch switches to method-name strings.
- `extended-actions.test.ts` APIS_ROUTING gains the extras block.
587/587 tests pass.
This commit is contained in:
1 parent
e5ac2a61b1
commit
22add4ad1c
8 files changed
+205
-204
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import type { SendPacketResult } from '../protocol/packet-sender';
|
||||
import type { ApiHub } from './apis';
|
||||
import type { MediaIndexNode } from './actions/shared';
|
||||
import type {
|
||||
ClientKeyInfo,
|
||||
DownloadRKeyInfo,
|
||||
@@ -90,11 +89,8 @@ export interface BridgeInterface {
|
||||
// ─── Misc (moved to apis.misc) ───
|
||||
// - translateEn2Zh / getMiniAppArk / clickInlineKeyboardButton / sendGroupSign
|
||||
|
||||
// ─── Tier-2 napcat parity extras ───
|
||||
setGroupTodo(groupId: number, msgSeq: bigint | number | string): Promise<void>;
|
||||
completeGroupTodo(groupId: number, msgSeq: bigint | number | string): Promise<void>;
|
||||
cancelGroupTodo(groupId: number, msgSeq: bigint | number | string): Promise<void>;
|
||||
getStrangerStatus(uin: number): Promise<{ status: number; ext_status: number } | null>;
|
||||
fetchAiVoiceList(groupId: number, chatType: number): Promise<Array<{ category: string; voices: Array<{ voiceId: string; voiceDisplayName: string; voiceExampleUrl: string }> }>>;
|
||||
fetchAiVoice(groupId: number, voiceId: string, text: string, chatType: number): Promise<MediaIndexNode>;
|
||||
// ─── Tier-2 napcat parity extras (moved to apis.extras) ───
|
||||
// - setGroupTodo / completeGroupTodo / cancelGroupTodo
|
||||
// - getStrangerStatus
|
||||
// - fetchAiVoiceList / fetchAiVoice
|
||||
}
|
||||
Reference in new issue
Block a user