mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix #428
This commit is contained in:
@@ -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);
|
||||||
|
@@ -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;
|
||||||
|
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user