diff --git a/docs/changelogs/CHANGELOG.v1.6.7.md b/docs/changelogs/CHANGELOG.v1.6.7.md index 854e70af..02d8d4f6 100644 --- a/docs/changelogs/CHANGELOG.v1.6.7.md +++ b/docs/changelogs/CHANGELOG.v1.6.7.md @@ -21,5 +21,6 @@ QQ Version: Windows 9.9.12-26000 / Linux 3.2.9-26000 4. 新增最近联系列表API(RAW 不稳定) 5. 上报群精华设置事件 6. 新增设置所有消息已读API(非标准) +7. 新增获取点赞信息获取API(非标准) 新增的 API 详细见[API文档](https://napneko.github.io/zh-CN/develop/extends_api) diff --git a/package.json b/package.json index 26045235..3ffd3b87 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "1.6.6", + "version": "1.6.7", "scripts": { "watch:dev": "vite --mode development", "watch:prod": "vite --mode production", diff --git a/src/core/src/apis/user.ts b/src/core/src/apis/user.ts index 597dffc6..c77db851 100644 --- a/src/core/src/apis/user.ts +++ b/src/core/src/apis/user.ts @@ -35,6 +35,20 @@ setTimeout(() => { // } // }; export class NTQQUserApi { + static async getProfileLike(uin: string) { + return napCatCore.session.getProfileLikeService().getBuddyProfileLike( { + "friendUids": [ + "u_FUSS0_x06S_9Tf4na_WpUg" + ], + "basic": 1, + "vote": 1, + "favorite": 0, + "userProfile": 1, + "type": 2, + "start": 0, + "limit": 20 + }); + } static async setLongNick(longNick: string) { return napCatCore.session.getProfileService().setLongNick(longNick); } diff --git a/src/core/src/services/NodeIKernelProfileLikeService.ts b/src/core/src/services/NodeIKernelProfileLikeService.ts index 0e30cefe..fa765695 100644 --- a/src/core/src/services/NodeIKernelProfileLikeService.ts +++ b/src/core/src/services/NodeIKernelProfileLikeService.ts @@ -1,4 +1,5 @@ import { BuddyProfileLikeReq } from "../entities/user"; +import { GeneralCallResult } from "./common"; export interface NodeIKernelProfileLikeService { addKernelProfileLikeListener(listener: NodeIKernelProfileLikeService): void; @@ -7,7 +8,13 @@ export interface NodeIKernelProfileLikeService { setBuddyProfileLike(...args: unknown[]): { result: number, errMsg: string, succCounts: number }; - getBuddyProfileLike(req: BuddyProfileLikeReq): void; + getBuddyProfileLike(req: BuddyProfileLikeReq): Promise, + "friendMaxVotes": number, + "start": number + } + }>; getProfileLikeScidResourceInfo(...args: unknown[]): void; diff --git a/src/core/src/services/NodeIKernelRobotService.ts b/src/core/src/services/NodeIKernelRobotService.ts index b406c001..14c1aef8 100644 --- a/src/core/src/services/NodeIKernelRobotService.ts +++ b/src/core/src/services/NodeIKernelRobotService.ts @@ -30,5 +30,6 @@ export interface NodeIKernelRobotService { setRobotPickTts(arg1: unknown, arg2: unknown): unknown; getRobotUinRange(data: any): Promise<{ response: { robotUinRanges: any } }> + isNull(): boolean; -} \ No newline at end of file +} diff --git a/src/onebot11/action/extends/GetProfileLike.ts b/src/onebot11/action/extends/GetProfileLike.ts new file mode 100644 index 00000000..9962459b --- /dev/null +++ b/src/onebot11/action/extends/GetProfileLike.ts @@ -0,0 +1,24 @@ +import BaseAction from '../BaseAction'; +import { ActionName } from '../types'; +import { NTQQUserApi } from '@/core/apis'; +import { FromSchema, JSONSchema } from 'json-schema-to-ts'; +const SchemaData = { + type: 'object', + properties: { + user_id: { + type: ['number', 'string'] + } + }, + required: ['user_id'], +} as const satisfies JSONSchema; + +type Payload = FromSchema; + +export class GetProfileLike extends BaseAction { + actionName = ActionName.GetProfileLike; + PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { + const ret = await NTQQUserApi.getProfileLike((await NTQQUserApi.getUidByUin(payload.user_id.toString()))!); + return ret.info; + } +} diff --git a/src/onebot11/action/index.ts b/src/onebot11/action/index.ts index 97a05acb..badd97b9 100644 --- a/src/onebot11/action/index.ts +++ b/src/onebot11/action/index.ts @@ -73,6 +73,7 @@ import { SetLongNick } from './extends/SetLongNick'; import DelEssenceMsg from './group/DelEssenceMsg'; import SetEssenceMsg from './group/SetEssenceMsg'; import GetRecentContact from './user/GetRecentContact'; +import { GetProfileLike } from './extends/GetProfileLike'; export const actionHandlers = [ new RebootNormal(), @@ -154,7 +155,8 @@ export const actionHandlers = [ new DelEssenceMsg(), new SetEssenceMsg(), new GetRecentContact(), - new MarkAllMsgAsRead() + new MarkAllMsgAsRead(), + new GetProfileLike() ]; function initActionMap() { diff --git a/src/onebot11/action/types.ts b/src/onebot11/action/types.ts index 2b0ed444..4786965c 100644 --- a/src/onebot11/action/types.ts +++ b/src/onebot11/action/types.ts @@ -97,5 +97,6 @@ export enum ActionName { SetEssenceMsg = "set_essence_msg", DelEssenceMsg = "delete_essence_msg", GetRecentContact = "get_recent_contact", - _MarkAllMsgAsRead = "_mark_all_as_read" + _MarkAllMsgAsRead = "_mark_all_as_read", + GetProfileLike = "get_profile_like" } diff --git a/src/onebot11/version.ts b/src/onebot11/version.ts index e3e54083..4be2f1ca 100644 --- a/src/onebot11/version.ts +++ b/src/onebot11/version.ts @@ -1 +1 @@ -export const version = '1.6.6'; +export const version = '1.6.7'; diff --git a/src/webui/ui/NapCat.ts b/src/webui/ui/NapCat.ts index 6cc995e9..26a6affe 100644 --- a/src/webui/ui/NapCat.ts +++ b/src/webui/ui/NapCat.ts @@ -29,7 +29,7 @@ async function onSettingWindowCreated(view: Element) { SettingItem( 'Napcat', undefined, - SettingButton('V1.6.6', 'napcat-update-button', 'secondary') + SettingButton('V1.6.7', 'napcat-update-button', 'secondary') ), ]), SettingList([ diff --git a/static/assets/renderer.js b/static/assets/renderer.js index 025d3eec..57780bb6 100644 --- a/static/assets/renderer.js +++ b/static/assets/renderer.js @@ -167,7 +167,7 @@ async function onSettingWindowCreated(view) { SettingItem( 'Napcat', void 0, - SettingButton("V1.6.6", "napcat-update-button", "secondary") + SettingButton("V1.6.7", "napcat-update-button", "secondary") ) ]), SettingList([