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
@@ -62,6 +62,13 @@ const APIS_ROUTING: Record<string, [string, string]> = {
|
||||
setFriendRemark: ['friend', 'setRemark'],
|
||||
deleteFriend: ['friend', 'delete'],
|
||||
setFriendAddRequest: ['friend', 'handleRequest'],
|
||||
// ExtrasApi: group todo / stranger status / AI voice.
|
||||
setGroupTodo: ['extras', 'setGroupTodo'],
|
||||
completeGroupTodo: ['extras', 'completeGroupTodo'],
|
||||
cancelGroupTodo: ['extras', 'cancelGroupTodo'],
|
||||
getStrangerStatus: ['extras', 'getStrangerStatus'],
|
||||
fetchAiVoiceList: ['extras', 'fetchAiVoiceList'],
|
||||
fetchAiVoice: ['extras', 'fetchAiVoice'],
|
||||
};
|
||||
|
||||
function fakeBridge(overrides: Record<string, any> = {}): BridgeInterface {
|
||||
|
||||
Reference in new issue
Block a user