feat(onebot): fetch custom face details
Add packet-backed custom face detail retrieval and expose the result through the OneBot action. Fixes #333
This commit is contained in:
8 files changed
+363
-7
No files matched your search
@@ -90,9 +90,9 @@ describe('compileActionRegistry namespace conflicts', () => {
|
||||
});
|
||||
|
||||
describe('compiled production Action registry', () => {
|
||||
it('preserves all 185 canonical Action docs', () => {
|
||||
expect(ACTION_REGISTRY.actions).toHaveLength(185);
|
||||
expect(collectActionDocs()).toHaveLength(185);
|
||||
it('preserves all 186 canonical Action docs', () => {
|
||||
expect(ACTION_REGISTRY.actions).toHaveLength(186);
|
||||
expect(collectActionDocs()).toHaveLength(186);
|
||||
});
|
||||
|
||||
it('resolves every executable name to exactly one canonical doc', () => {
|
||||
|
||||
@@ -61,6 +61,7 @@ const APIS_ROUTING: Record<string, [string, string]> = {
|
||||
setAvatar: ['profile', 'setAvatar'],
|
||||
setGroupAvatar: ['profile', 'setGroupAvatar'],
|
||||
fetchCustomFace: ['profile', 'fetchCustomFace'],
|
||||
fetchCustomFaceDetails: ['profile', 'fetchCustomFaceDetails'],
|
||||
getProfileLike: ['profile', 'getLike'],
|
||||
getUnidirectionalFriendList: ['profile', 'getUnidirectionalFriendList'],
|
||||
// FriendApi: handleRequest/delete/setRemark.
|
||||
@@ -1407,6 +1408,51 @@ describe('extended-actions / set_group_portrait', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('extended-actions / fetch_custom_face_detail', () => {
|
||||
it('returns real packet-backed fields with SnowLuma and NapCat resource aliases', async () => {
|
||||
const fetchCustomFaceDetails = vi.fn(async () => [{
|
||||
emojiId: '10001_0_0_0_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA_0_0',
|
||||
url: 'https://p.qpic.cn/qq_expression/10001/id/0',
|
||||
md5: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
||||
desc: '开心',
|
||||
}]);
|
||||
const bridge = fakeBridge({ fetchCustomFaceDetails });
|
||||
|
||||
const response = await makeHandler(fakeCtx(bridge)).handle('fetch_custom_face_detail', {
|
||||
count: '1',
|
||||
});
|
||||
|
||||
expect(fetchCustomFaceDetails).toHaveBeenCalledWith(1);
|
||||
expect(response).toMatchObject({
|
||||
status: 'ok',
|
||||
data: [{
|
||||
emoji_id: '10001_0_0_0_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA_0_0',
|
||||
resId: '10001_0_0_0_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA_0_0',
|
||||
url: 'https://p.qpic.cn/qq_expression/10001/id/0',
|
||||
md5: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
|
||||
desc: '开心',
|
||||
}],
|
||||
});
|
||||
});
|
||||
|
||||
it('defaults to the compatibility page size of 48', async () => {
|
||||
const fetchCustomFaceDetails = vi.fn(async () => []);
|
||||
const bridge = fakeBridge({ fetchCustomFaceDetails });
|
||||
await makeHandler(fakeCtx(bridge)).handle('fetch_custom_face_detail', {});
|
||||
expect(fetchCustomFaceDetails).toHaveBeenCalledWith(48);
|
||||
});
|
||||
|
||||
it('rejects a negative count before calling the bridge', async () => {
|
||||
const fetchCustomFaceDetails = vi.fn();
|
||||
const bridge = fakeBridge({ fetchCustomFaceDetails });
|
||||
const response = await makeHandler(fakeCtx(bridge)).handle('fetch_custom_face_detail', {
|
||||
count: -1,
|
||||
});
|
||||
expect(response).toMatchObject({ status: 'failed', retcode: 1400 });
|
||||
expect(fetchCustomFaceDetails).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
// ─── Wave 1: get_group_shut_list ───
|
||||
|
||||
describe('extended-actions / get_group_shut_list', () => {
|
||||
|
||||
Reference in new issue
Block a user