mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
fix: friend uid 异常
This commit is contained in:
parent
29904f3cb7
commit
22faac7e36
@ -1,7 +1,7 @@
|
||||
import { ModifyProfileParams, SelfInfo, User, UserDetailInfoByUin } from '@/core/entities';
|
||||
import { selfInfo } from '@/core/data';
|
||||
import { friends, selfInfo } from '@/core/data';
|
||||
import { CacheClassFuncAsync } from '@/common/utils/helper';
|
||||
import { GeneralCallResult, napCatCore } from '@/core';
|
||||
import { GeneralCallResult, napCatCore, NTQQFriendApi } from '@/core';
|
||||
import { ProfileListener } from '@/core/listeners';
|
||||
import { rejects } from 'assert';
|
||||
import { randomUUID } from 'crypto';
|
||||
@ -170,7 +170,18 @@ export class NTQQUserApi {
|
||||
5000,
|
||||
[Uin]
|
||||
);
|
||||
return ret.uidInfo.get(Uin);
|
||||
let uid = ret.uidInfo.get(Uin);
|
||||
//let t = await NTQQUserApi.getUserDetailInfoByUin(Uin);
|
||||
if (!uid) {
|
||||
uid = (await NTQQFriendApi.getFriends(true)).find((t) => { t.uin == Uin })?.uid;
|
||||
}
|
||||
if (!uid) {
|
||||
uid = Array.from(friends.values()).find((t) => { t.uin == Uin })?.uid;
|
||||
}
|
||||
if (!uid) {
|
||||
//uid获取失败
|
||||
}
|
||||
return uid;
|
||||
}
|
||||
static async getUinByUid(Uid: string | undefined) {
|
||||
if (!Uid) {
|
||||
|
@ -102,6 +102,7 @@ async function createContext(payload: OB11PostSendMsg, contextMode: ContextMode)
|
||||
if ((contextMode === ContextMode.Private || contextMode === ContextMode.Normal) && payload.user_id) {
|
||||
const Uid = await NTQQUserApi.getUidByUin(payload.user_id.toString());
|
||||
const isBuddy = await NTQQFriendApi.isBuddy(Uid!);
|
||||
//console.log("[调试代码] UIN:", payload.user_id, " UID:", Uid, " IsBuddy:", isBuddy);
|
||||
return {
|
||||
peer: {
|
||||
chatType: isBuddy ? ChatType.friend : ChatType.temp,
|
||||
|
Loading…
x
Reference in New Issue
Block a user