feat(onebot): support choosing animated system faces
Send available face animations by default and accept large=false for the small representation. Preserve the sticker business type when encoding animated faces. Fixes #483
This commit is contained in:
8 files changed
+64
-22
No files matched your search
@@ -43,6 +43,18 @@ describe('parseMessage', () => {
|
||||
expect(result[0].faceId).toBe(123);
|
||||
});
|
||||
|
||||
it.each([true, false, 'true', 'false', 1, 0, '1', '0'])('preserves face animation choice %s', async (large) => {
|
||||
const result = await parseMessage([{ type: 'face', data: { id: '424', large } }], false);
|
||||
expect(result).toEqual([{ type: 'face', faceId: 424, large: [true, 'true', 1, '1'].includes(large) }]);
|
||||
});
|
||||
|
||||
it('accepts the CQ animation switch and rejects invalid booleans', async () => {
|
||||
expect(await parseMessage('[CQ:face,id=424,large=false]', false))
|
||||
.toEqual([{ type: 'face', faceId: 424, large: false }]);
|
||||
await expect(parseMessage('[CQ:face,id=424,large=maybe]', false))
|
||||
.rejects.toMatchObject({ code: 'INVALID_FIELD' });
|
||||
});
|
||||
|
||||
it('parses at CQ code', async () => {
|
||||
const result = await parseMessage('[CQ:at,qq=12345]', false);
|
||||
expect(result).toHaveLength(1);
|
||||
|
||||
Reference in new issue
Block a user