12 files changed
+1066
-11
No files matched your search
@@ -4,6 +4,10 @@ import {
|
||||
type AiVoiceCategory as NamespaceAiVoiceCategory,
|
||||
} from '@snowluma/protocol/oidb-services/extras/fetch-ai-voice-list';
|
||||
import { GetStrangerStatus, type StrangerStatus as NamespaceStrangerStatus } from '@snowluma/protocol/oidb-services/extras/get-stranger-status';
|
||||
import {
|
||||
GetGroupTodoList,
|
||||
type GroupTodoListItem as NamespaceGroupTodoListItem,
|
||||
} from '@snowluma/protocol/oidb-services/extras/get-group-todo-list';
|
||||
import { GroupTodo } from '@snowluma/protocol/oidb-services/extras/group-todo';
|
||||
import { convertAudioBytes } from '@snowluma/protocol/highway/ffmpeg-addon';
|
||||
import { loadBinarySource } from '@snowluma/protocol/highway/utils';
|
||||
@@ -35,6 +39,7 @@ export interface PttTransInput {
|
||||
// ─────────────── public types (re-exported from bridge.ts as before) ───
|
||||
|
||||
export type StrangerStatus = NamespaceStrangerStatus;
|
||||
export type GroupTodoListItem = NamespaceGroupTodoListItem;
|
||||
|
||||
export const AiVoiceChatType = {
|
||||
Unknown: 0,
|
||||
@@ -87,7 +92,13 @@ export class ExtrasApi {
|
||||
|
||||
constructor(private readonly ctx: BridgeContext) { }
|
||||
|
||||
// ─────────────── Group todo (0xF90) ───────────────
|
||||
// ─────────────── Group todo query / mutations (0x9474 / 0xF90) ───────────────
|
||||
|
||||
async getGroupTodoList(groupId: number): Promise<GroupTodoListItem[]> {
|
||||
const items = await GetGroupTodoList.invoke(this.ctx, { groupId });
|
||||
log.debug('group todo list fetched group=%d count=%d', groupId, items.length);
|
||||
return items;
|
||||
}
|
||||
|
||||
setGroupTodo(groupId: number, msgSeq: bigint): Promise<void> {
|
||||
return GroupTodo.invoke(this.ctx, { groupId, msgSeq, action: 'set' });
|
||||
|
||||
@@ -5,6 +5,8 @@ import type { QQEventVariant } from '@snowluma/protocol/events';
|
||||
import type { OidbBase } from '@snowluma/proto-defs/oidb';
|
||||
import type {
|
||||
OidbGroupTodo,
|
||||
OidbQueryGroupTopBannersReq,
|
||||
OidbQueryGroupTopBannersResp,
|
||||
OidbStrangerStatusReq,
|
||||
OidbStrangerStatusResp,
|
||||
} from '@snowluma/proto-defs/oidb-actions/base';
|
||||
@@ -15,7 +17,7 @@ import type {
|
||||
OidbAiVoiceResp,
|
||||
} from '@snowluma/proto-defs/oidb-actions/media';
|
||||
|
||||
// Post-namespace migration: ExtrasApi forwards 6 OIDB cmds through
|
||||
// Post-namespace migration: ExtrasApi forwards OIDB cmds through
|
||||
// namespaces under @snowluma/protocol/oidb-services/extras. Tests assert
|
||||
// against bridge.sendRawPacket directly.
|
||||
import { ExtrasApi, AiVoiceChatType } from '../../src/bridge/apis/extras';
|
||||
@@ -28,7 +30,21 @@ function packResponse(body: Uint8Array) {
|
||||
};
|
||||
}
|
||||
|
||||
describe('apis/extras / group todo (0xF90)', () => {
|
||||
describe('apis/extras / group todo (0x9474 / 0xF90)', () => {
|
||||
it('getGroupTodoList dispatches the todo-only banner query', async () => {
|
||||
const bridge = mockBridge();
|
||||
bridge.sendRawPacket.mockResolvedValueOnce(packResponse(
|
||||
protobuf_encode<OidbBase<OidbQueryGroupTopBannersResp>>({ body: {} }),
|
||||
));
|
||||
|
||||
await expect(new ExtrasApi(bridge as any).getGroupTodoList(12345)).resolves.toEqual([]);
|
||||
|
||||
const [wireName, bytes] = bridge.sendRawPacket.mock.calls[0]!;
|
||||
expect(wireName).toBe('OidbSvcTrpcTcp.0x9474_0');
|
||||
const env = protobuf_decode<OidbBase<OidbQueryGroupTopBannersReq>>(bytes);
|
||||
expect(env.body).toEqual({ groupId: 12345n, bannerFlag: 1 });
|
||||
});
|
||||
|
||||
it.each([
|
||||
['setGroupTodo', 'OidbSvcTrpcTcp.0xf90_1'] as const,
|
||||
['completeGroupTodo', 'OidbSvcTrpcTcp.0xf90_2'] as const,
|
||||
|
||||
Reference in new issue
Block a user