fix(onebot): repair group system message queries

This commit is contained in:
DrSmoothl committed 2026-07-10 19:11:15 +08:00
1 parent b53004ee23
commit a824e0b46a
6 files changed
+229 -24

No files matched your search

+20 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it } from 'vitest';
import { describe, expect, it, vi } from 'vitest';
import { defineAction, defineStreamAction, type RegisteredActionSpec } from '../src/action-kit';
import { ApiHandler, type ApiActionContext } from '../src/api-handler';
import {
@@ -129,6 +129,25 @@ describe('compiled production Action registry', () => {
.map((entry) => [entry.name, entry.kind]),
);
});
it('validates and forwards get_group_system_msg filters', async () => {
const handleGetGroupSystemMsg = vi.fn(async () => []);
const handler = new ApiHandler({ handleGetGroupSystemMsg } as unknown as ApiActionContext);
const response = await handler.handle('get_group_system_msg', {
group_id: '100000002',
only_pending: true,
});
expect(response.status).toBe('ok');
expect(handleGetGroupSystemMsg).toHaveBeenCalledWith({
groupId: 100000002,
onlyPending: true,
});
const doc = ACTION_REGISTRY.resolve('get_group_system_msg');
if (!doc || doc.kind === 'raw') throw new Error('get_group_system_msg action missing');
expect(doc.action.doc.params.map((param) => param.name)).toEqual(['group_id', 'only_pending']);
});
});
describe('ApiHandler constructor-time registry transaction', () => {