fix(onebot): restore doubt-request account ids from the native list
get_doubt_friends_add_request was rereading the uid as a number, so uid came back empty and user_id was wrong. Keep the uid string and the account number as separate fields. Fixes #410
This commit is contained in:
2 files changed
+27
-27
No files matched your search
@@ -59,4 +59,26 @@ describe('GetDoubtBuddyReq namespace', () => {
|
||||
it('deserialize returns [] when the body has no list', () => {
|
||||
expect(GetDoubtBuddyReq.deserialize({} as any, { status: 1 })).toEqual([]);
|
||||
});
|
||||
|
||||
it('keeps the uid string and does not reread it as the account number', async () => {
|
||||
const respEnv: OidbBase<OidbDoubtGetResp> = {
|
||||
command: 0xD69, subCommand: 0,
|
||||
body: { status: 1, body: { list: [
|
||||
{ uid: 'u_alice', nick: 'Alice', msg: 'hi', source: 'QQ号查找', reason: 'caution' },
|
||||
] } },
|
||||
};
|
||||
const sender = {
|
||||
sendRawPacket: vi.fn(async () => ({
|
||||
success: true, gotResponse: true, errorCode: 0, errorMessage: '',
|
||||
responseData: Buffer.from(protobuf_encode<OidbBase<OidbDoubtGetResp>>(respEnv)),
|
||||
})),
|
||||
};
|
||||
const list = await GetDoubtBuddyReq.invoke(sender, { count: 10 });
|
||||
expect(list).toEqual([
|
||||
{
|
||||
uid: 'u_alice', user_id: 0, nick: 'Alice', source: 'QQ号查找',
|
||||
reason: 'caution', msg: 'hi', group_code: '', reqTime: 0,
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user