feat(profile): surface QQ level from OIDB 0xFE1_2 number-property 105
`fetchUserProfile` already requested key 105 in the keys[] array but the decode pass never read it, so callers got nothing. NapCat exposes the same value as `qq_level` on `get_stranger_info`; users coming from NapCat noticed the field was missing on the SnowLuma side. Cross-checked against LagrangeV2 Internal/Services/System/ FetchStrangerService.cs which explicitly labels key 105 = Level and uses `numbers[105]` directly. Changes: - UserProfileInfo: add `level: number`. - fetchUserProfile decode: `info.level = numMap.get(105) ?? 0`. - getStrangerInfo: emit both `qq_level` (NapCat-compat) and `level`. - Test/manager call sites updated for the new required field.
This commit is contained in:
5 files changed
+16
-3
No files matched your search
@@ -281,7 +281,7 @@ export class ContactsApi {
|
||||
const info: UserProfileInfo = {
|
||||
uin: resp.body.uin ?? uin,
|
||||
uid: resp.body.uid ?? '',
|
||||
nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '',
|
||||
nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0,
|
||||
};
|
||||
|
||||
if (resp.body.properties) {
|
||||
@@ -310,6 +310,7 @@ export class ContactsApi {
|
||||
const sexNum = numMap.get(20009) ?? 0;
|
||||
info.sex = sexNum === 1 ? 'male' : sexNum === 2 ? 'female' : 'unknown';
|
||||
info.age = numMap.get(20037) ?? 0;
|
||||
info.level = numMap.get(105) ?? 0;
|
||||
}
|
||||
|
||||
this.ctx.identity.rememberUserProfile(info);
|
||||
|
||||
@@ -188,7 +188,7 @@ describe('IdentityService', () => {
|
||||
|
||||
describe('IdentityService.resolveUid', () => {
|
||||
function makeProfile(uin: number, uid: string): UserProfileInfo {
|
||||
return { uin, uid, nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '' };
|
||||
return { uin, uid, nickname: '', remark: '', qid: '', sex: 'unknown', age: 0, sign: '', avatar: '', level: 0 };
|
||||
}
|
||||
|
||||
it('returns the cached uid without invoking the fetcher', async () => {
|
||||
|
||||
Reference in new issue
Block a user