mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix
This commit is contained in:
@@ -207,8 +207,8 @@ interface PhotoWall {
|
||||
|
||||
// 简单信息
|
||||
export interface SimpleInfo {
|
||||
uid?: string;
|
||||
uin?: string;
|
||||
uid: string;
|
||||
uin: string;
|
||||
coreInfo: CoreInfo;
|
||||
baseInfo: BaseInfo;
|
||||
status: UserStatus | null;
|
||||
|
@@ -15,7 +15,24 @@ export default class GetFriendList extends OneBotAction<Payload, OB11User[]> {
|
||||
override payloadSchema = SchemaData;
|
||||
|
||||
async _handle(_payload: Payload) {
|
||||
//全新逻辑
|
||||
return OB11Construct.friends(await this.core.apis.FriendApi.getBuddy());
|
||||
// 获取好友列表
|
||||
let buddyList = await this.core.apis.FriendApi.getBuddyV2SimpleInfoMap();
|
||||
const buddyArray = Array.from(buddyList.values());
|
||||
|
||||
// 批量并行获取用户详情
|
||||
const userDetailsPromises = buddyArray.map(member =>
|
||||
this.core.apis.UserApi.getUserDetailInfoV2(member.uin ?? '')
|
||||
.catch(_ => {
|
||||
return { uin: member.uin, uid: member.uid };
|
||||
})
|
||||
);
|
||||
const userDetails = await Promise.all(userDetailsPromises);
|
||||
|
||||
const friendList = buddyArray.map((friend, index) => {
|
||||
const userDetail = userDetails[index] || { uin: friend.uin, uid: friend.uid };
|
||||
return OB11Construct.friend(friend, userDetail);
|
||||
});
|
||||
|
||||
return friendList;
|
||||
}
|
||||
}
|
||||
}
|
@@ -34,7 +34,23 @@ export class OB11Construct {
|
||||
level: 0,
|
||||
}));
|
||||
}
|
||||
|
||||
static friend(friends: FriendV2,info:UserV2): OB11User {
|
||||
return {
|
||||
birthday_year: friends.baseInfo.birthday_year,
|
||||
birthday_month: friends.baseInfo.birthday_month,
|
||||
birthday_day: friends.baseInfo.birthday_day,
|
||||
user_id: parseInt(friends.coreInfo.uin),
|
||||
age: friends.baseInfo.age,
|
||||
phone_num: friends.baseInfo.phoneNum,
|
||||
email: friends.baseInfo.eMail,
|
||||
category_id: friends.baseInfo.categoryId,
|
||||
nickname: friends.coreInfo.nick ?? '',
|
||||
remark: friends.coreInfo.remark ?? friends.coreInfo.nick,
|
||||
sex: this.sex(friends.baseInfo.sex),
|
||||
level: calcQQLevel(info?.commonExt?.qqLevel) || 0,
|
||||
qid: friends.baseInfo.qid,
|
||||
};
|
||||
}
|
||||
static groupMemberRole(role: number): OB11GroupMemberRole | undefined {
|
||||
return {
|
||||
4: OB11GroupMemberRole.owner,
|
||||
|
@@ -1,4 +1,10 @@
|
||||
export interface OB11User {
|
||||
birthday_year?: number;
|
||||
birthday_month?: number;
|
||||
birthday_day?: number;
|
||||
phone_num?: string; // 手机号
|
||||
email?: string; // 邮箱
|
||||
category_id?: number; // 分组ID
|
||||
user_id: number; // 用户ID
|
||||
nickname: string; // 昵称
|
||||
remark?: string; // 备注
|
||||
|
Reference in New Issue
Block a user