From 52b3540ec3bdcee772aa66168bab2ec05c3c0925 Mon Sep 17 00:00:00 2001 From: Nepenthe Date: Tue, 29 Oct 2024 07:51:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/apis/user.ts | 6 +++--- src/onebot/action/extends/GetProfileLike.ts | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/core/apis/user.ts b/src/core/apis/user.ts index ed912396..de985b3e 100644 --- a/src/core/apis/user.ts +++ b/src/core/apis/user.ts @@ -18,7 +18,7 @@ export class NTQQUserApi { async getStatusByUid(uid: string) { return this.context.session.getProfileService().getStatus(uid); } - async getProfileLike(uid: string) { + async getProfileLike(uid: string, start: number, count: number) { return this.context.session.getProfileLikeService().getBuddyProfileLike({ friendUids: [uid], basic: 1, @@ -26,8 +26,8 @@ export class NTQQUserApi { favorite: 0, userProfile: 1, type: 2, - start: 0, - limit: 20, + start: start, + limit: count, }); } async fetchOtherProfileLike(uid: string) { diff --git a/src/onebot/action/extends/GetProfileLike.ts b/src/onebot/action/extends/GetProfileLike.ts index 578bc28e..36910a3c 100644 --- a/src/onebot/action/extends/GetProfileLike.ts +++ b/src/onebot/action/extends/GetProfileLike.ts @@ -1,15 +1,22 @@ import BaseAction from '../BaseAction'; -import { ActionName } from '../types'; +import { ActionName, BaseCheckResult } from '../types'; -export class GetProfileLike extends BaseAction { +interface Payload { + start: number, + count: number +} + +export class GetProfileLike extends BaseAction { actionName = ActionName.GetProfileLike; - async _handle(payload: void) { - const ret = await this.core.apis.UserApi.getProfileLike(this.core.selfInfo.uid); - const listdata: any[] = ret.info.userLikeInfos[0].favoriteInfo.userInfos; + async _handle(payload: Payload) { + const start = payload.start ? Number(payload.start) : 0; + const count = payload.count ? Number(payload.count) : 10; + const ret = await this.core.apis.UserApi.getProfileLike(this.core.selfInfo.uid, start, count); + const listdata: any[] = ret.info.userLikeInfos[0].voteInfo.userInfos; for (let i = 0; i < listdata.length; i++) { listdata[i].uin = parseInt((await this.core.apis.UserApi.getUinByUidV2(listdata[i].uid)) || ''); } - return listdata; + return ret.info.userLikeInfos[0].voteInfo; } }