fix(onebot): add canonical fields to file segment and fix log rendering (#94)
* fix(onebot): support inline file url/path in send_group/private_msg * test(onebot): update file segment parser test for inline url/path support * fix(onebot): add canonical fields to file segment and fix log rendering
This commit is contained in:
1 parent
d804a3b2e0
commit
d2a67cb560
4 files changed
+35
-6
No files matched your search
@@ -438,14 +438,18 @@ describe('convertEvent — message elements (13 segment types)', () => {
|
||||
expect((seg2.data as Record<string, unknown>).resid).toBe(50);
|
||||
});
|
||||
|
||||
it('file: name + size + id + url + file_hash, url via mediaUrlResolver', async () => {
|
||||
it('file: canonical file/file_id/file_size + legacy name/size/id + url + file_hash', async () => {
|
||||
const seg = await segment(
|
||||
{ type: 'file', fileName: 'doc.pdf', fileSize: 7, fileId: 'fid', fileHash: 'h' },
|
||||
{ mediaUrlResolver: async () => 'http://download' },
|
||||
);
|
||||
expect(seg.type).toBe('file');
|
||||
expect(seg.data).toEqual({
|
||||
name: 'doc.pdf', size: 7, id: 'fid', url: 'http://download', file_hash: 'h',
|
||||
// NapCat/LLOneBot-style canonical fields
|
||||
file: 'doc.pdf', file_id: 'fid', file_size: 7,
|
||||
// legacy SnowLuma fields
|
||||
name: 'doc.pdf', size: 7, id: 'fid',
|
||||
url: 'http://download', file_hash: 'h',
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user