Compare commits

..

2 Commits

Author SHA1 Message Date
手瓜一十雪
e8d6f86458 feat: 修复一些问题 2025-11-07 19:35:35 +08:00
手瓜一十雪
a000ffdf0d fix: buddylist 2025-11-07 19:29:39 +08:00
8 changed files with 84 additions and 71 deletions

2
.gitignore vendored
View File

@@ -15,3 +15,5 @@ devconfig/*
checkVersion.sh checkVersion.sh
bun.lockb bun.lockb
tests/run/ tests/run/
guild1.db-wal
guild1.db-shm

View File

@@ -17,8 +17,14 @@ export class NTQQFriendApi {
async getBuddyV2SimpleInfoMap () { async getBuddyV2SimpleInfoMap () {
const buddyService = this.context.session.getBuddyService(); const buddyService = this.context.session.getBuddyService();
let uids: string[] = [];
if (this.core.context.basicInfoWrapper.requireMinNTQQBuild('40990')) {
const buddyListV2NT = await buddyService.getBuddyListV2('0', true, BuddyListReqType.KNOMAL);
uids = buddyListV2NT.data.flatMap(item => item.buddyUids);
} else {
const buddyListV2 = await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL); const buddyListV2 = await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL);
const uids = buddyListV2.data.flatMap(item => item.buddyUids); uids = buddyListV2.data.flatMap(item => item.buddyUids);
}
return await this.core.eventWrapper.callNoListenerEvent( return await this.core.eventWrapper.callNoListenerEvent(
'NodeIKernelProfileService/getCoreAndBaseInfo', 'NodeIKernelProfileService/getCoreAndBaseInfo',
'nodeStore', 'nodeStore',

View File

@@ -10,9 +10,20 @@ export interface NodeIKernelBuddyService {
categroyName: string, categroyName: string,
categroyMbCount: number, categroyMbCount: number,
onlineCount: number, onlineCount: number,
buddyUids: Array<string> buddyUids: Array<string>;
}>
}>; }>;
}>;
getBuddyListV2 (callFrom: string, isPullRefresh: boolean, reqType: BuddyListReqType): Promise<GeneralCallResult & {
data: Array<{
categoryId: number,
categorySortId: number,
categroyName: string,
categroyMbCount: number,
onlineCount: number,
buddyUids: Array<string>;
}>;
}>;
getBuddyListFromCache (reqType: BuddyListReqType): Promise<Array< getBuddyListFromCache (reqType: BuddyListReqType): Promise<Array<
{ {
@@ -21,7 +32,7 @@ export interface NodeIKernelBuddyService {
categroyName: string, // 分类名 categroyName: string, // 分类名
categroyMbCount: number, // 不懂 categroyMbCount: number, // 不懂
onlineCount: number, // 在线数目 onlineCount: number, // 在线数目
buddyUids: Array<string>// Uids buddyUids: Array<string>;// Uids
}>>; }>>;
addKernelBuddyListener (listener: NodeIKernelBuddyListener): number; addKernelBuddyListener (listener: NodeIKernelBuddyListener): number;
@@ -36,7 +47,7 @@ export interface NodeIKernelBuddyService {
getBuddyRemark (uid: number): string; getBuddyRemark (uid: number): string;
setBuddyRemark(param: { uid: string, remark: string, signInfo?: unknown }): void; setBuddyRemark (param: { uid: string, remark: string, signInfo?: unknown; }): void;
getAvatarUrl (uid: number): string; getAvatarUrl (uid: number): string;
@@ -118,7 +129,7 @@ export interface NodeIKernelBuddyService {
reportDoubtBuddyReqUnread (): void; reportDoubtBuddyReqUnread (): void;
getBuddyRecommendContactArkJson(uid: string, phoneNumber: string): Promise<GeneralCallResult & { arkMsg: string }>; getBuddyRecommendContactArkJson (uid: string, phoneNumber: string): Promise<GeneralCallResult & { arkMsg: string; }>;
isNull (): boolean; isNull (): boolean;
} }

View File

@@ -1434,8 +1434,7 @@ export class OneBotMsgApi {
+await this.core.apis.UserApi.getUinByUidV2(groupInvite.invitorUid), +await this.core.apis.UserApi.getUinByUidV2(groupInvite.invitorUid),
'invite', 'invite',
'', '',
request_seq, request_seq
+await this.core.apis.UserApi.getUinByUidV2(groupInvite.invitorUid)
); );
} else if (SysMessage.contentHead.type === 528 && SysMessage.contentHead.subType === 39 && SysMessage.body?.msgContent) { } else if (SysMessage.contentHead.type === 528 && SysMessage.contentHead.subType === 39 && SysMessage.body?.msgContent) {
return await this.obContext.apis.UserApi.parseLikeEvent(SysMessage.body?.msgContent); return await this.obContext.apis.UserApi.parseLikeEvent(SysMessage.body?.msgContent);

View File

@@ -9,15 +9,13 @@ export class OB11GroupRequestEvent extends OB11BaseRequestEvent {
comment: string; comment: string;
flag: string; flag: string;
sub_type: string; sub_type: string;
invitor_id?: number;
constructor (core: NapCatCore, groupId: number, userId: number, sub_type: string, comment: string, flag: string, invitorId?: number) { constructor (core: NapCatCore, groupId: number, userId: number, sub_type: string, comment: string, flag: string) {
super(core); super(core);
this.group_id = groupId; this.group_id = groupId;
this.user_id = userId; this.user_id = userId;
this.sub_type = sub_type; this.sub_type = sub_type;
this.comment = comment; this.comment = comment;
this.flag = flag; this.flag = flag;
this.invitor_id = invitorId;
} }
} }

View File

@@ -466,15 +466,13 @@ export class NapCatOneBot11Adapter {
notify.status === GroupNotifyMsgStatus.KUNHANDLE notify.status === GroupNotifyMsgStatus.KUNHANDLE
) { ) {
this.context.logger.logDebug(`收到邀请我加群通知:${notify}`); this.context.logger.logDebug(`收到邀请我加群通知:${notify}`);
const inviterUin = +await this.core.apis.UserApi.getUinByUidV2(notify.user2.uid);
const groupInviteEvent = new OB11GroupRequestEvent( const groupInviteEvent = new OB11GroupRequestEvent(
this.core, this.core,
+notify.group.groupCode, +notify.group.groupCode,
inviterUin, +await this.core.apis.UserApi.getUinByUidV2(notify.user2.uid),
'invite', 'invite',
notify.postscript, notify.postscript,
flag, flag
inviterUin
); );
this.networkManager this.networkManager
.emitEvent(groupInviteEvent) .emitEvent(groupInviteEvent)
@@ -490,10 +488,9 @@ export class NapCatOneBot11Adapter {
this.core, this.core,
+notify.group.groupCode, +notify.group.groupCode,
+await this.core.apis.UserApi.getUinByUidV2(notify.user1.uid), +await this.core.apis.UserApi.getUinByUidV2(notify.user1.uid),
'invite', 'add',
notify.postscript, notify.postscript,
flag, flag
+await this.core.apis.UserApi.getUinByUidV2(notify.user2.uid)
); );
this.networkManager this.networkManager
.emitEvent(groupInviteEvent) .emitEvent(groupInviteEvent)

Binary file not shown.