This commit is contained in:
手瓜一十雪
2024-10-14 22:08:00 +08:00
parent 27081ae599
commit 10e281ed35
3 changed files with 12 additions and 2 deletions

View File

@@ -10,7 +10,9 @@ export class NTQQFriendApi {
this.context = context; this.context = context;
this.core = core; this.core = core;
} }
async setBuddyRemark(uid: string, remark: string) {
return this.context.session.getBuddyService().setBuddyRemark(uid, remark);
}
async getBuddyV2SimpleInfoMap(refresh = false) { async getBuddyV2SimpleInfoMap(refresh = false) {
const buddyService = this.context.session.getBuddyService(); const buddyService = this.context.session.getBuddyService();
const buddyListV2 = refresh ? await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL) : await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL); const buddyListV2 = refresh ? await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL) : await buddyService.getBuddyListV2('0', BuddyListReqType.KNOMAL);

View File

@@ -36,7 +36,7 @@ export interface NodeIKernelBuddyService {
getBuddyRemark(uid: number): string; getBuddyRemark(uid: number): string;
setBuddyRemark(uid: number, remark: string): void; setBuddyRemark(uid: string, remark: string): void;
getAvatarUrl(uid: number): string; getAvatarUrl(uid: number): string;

View File

@@ -21,6 +21,14 @@ export default class SetFriendAddRequest extends BaseAction<Payload, null> {
async _handle(payload: Payload): Promise<null> { async _handle(payload: Payload): Promise<null> {
const approve = payload.approve?.toString() !== 'false'; const approve = payload.approve?.toString() !== 'false';
await this.core.apis.FriendApi.handleFriendRequest(payload.flag, approve); await this.core.apis.FriendApi.handleFriendRequest(payload.flag, approve);
if (payload.remark) {
const data = payload.flag.split('|');
if (data.length < 2) {
throw new Error('Invalid flag');
}
const friendUid = data[0];
await this.core.apis.FriendApi.setBuddyRemark(friendUid, payload.remark);
}
return null; return null;
} }
} }