Skip to content

Commit f20de03

Browse files
committed
feat
1 parent b14fa0e commit f20de03

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

src/main/pmhq/mixins/user.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export function UserMixin<T extends new (...args: any[]) => PMHQBase>(Base: T) {
1212
{ key: 103 }, // 备注
1313
{ key: 104 }, // 标签
1414
{ key: 105 }, // 等级
15+
{ key: 107 }, // 业务列表
1516
{ key: 20002 }, // 昵称
1617
{ key: 20003 }, // 国家
1718
{ key: 20009 }, // 性别
@@ -34,6 +35,7 @@ export function UserMixin<T extends new (...args: any[]) => PMHQBase>(Base: T) {
3435
const info = Oidb.FetchUserInfoResp.decode(oidbRespBody)
3536
const numbers = Object.fromEntries(info.body.properties.numberProperties.map(p => [p.key, p.value]))
3637
const bytes = Object.fromEntries(info.body.properties.bytesProperties.map(p => [p.key, p.value]))
38+
const business = bytes[107] ? Misc.UserInfoBusiness.decode(bytes[107]) : undefined
3739
return {
3840
uin: info.body.uin,
3941
nick: bytes[20002]?.toString() ?? '',
@@ -51,6 +53,9 @@ export function UserMixin<T extends new (...args: any[]) => PMHQBase>(Base: T) {
5153
labels: bytes[104] ? Misc.UserInfoLabel.decode(bytes[104]).labels.map(e => e.content) : [],
5254
school: bytes[20021]?.toString() ?? '',
5355
remark: bytes[103]?.toString() ?? '',
56+
isVip: !!business?.body.lists[0],
57+
isYearsVip: !!business?.body.lists[0]?.isYear,
58+
vipLevel: business?.body.lists[0]?.level ?? 0
5459
}
5560
}
5661

src/ntqqapi/proto/misc.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,19 @@ export namespace Misc {
66
content: ProtoField(4, 'string')
77
}, 'repeated')
88
})
9+
10+
export const UserInfoBusiness = ProtoMessage.of({
11+
body: ProtoField(3, {
12+
msg: ProtoField(1, 'string'),
13+
lists: ProtoField(3, {
14+
type: ProtoField(1, 'uint32'),
15+
field2: ProtoField(2, 'uint32'),
16+
isYear: ProtoField(3, 'uint32'),
17+
level: ProtoField(4, 'uint32'),
18+
isPro: ProtoField(5, 'uint32'),
19+
icon1: ProtoField(6, 'string'),
20+
icon2: ProtoField(7, 'string')
21+
}, 'repeated')
22+
})
23+
})
924
}

src/onebot11/action/go-cqhttp/GetStrangerInfo.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ interface Response extends OB11User {
1616
city: string
1717
country: string
1818
labels: string[]
19+
is_vip: boolean
20+
is_years_vip: boolean
21+
vip_level: number
22+
remark: string
1923
}
2024

2125
export class GetStrangerInfo extends BaseAction<Payload, Response> {
@@ -43,7 +47,11 @@ export class GetStrangerInfo extends BaseAction<Payload, Response> {
4347
birthday_year: info.birthdayYear,
4448
birthday_month: info.birthdayMonth,
4549
birthday_day: info.birthdayDay,
46-
labels: info.labels
50+
labels: info.labels,
51+
is_vip: info.isVip,
52+
is_years_vip: info.isYearsVip,
53+
vip_level: info.vipLevel,
54+
remark: info.remark
4755
}
4856
}
4957
}

0 commit comments

Comments
 (0)