From 03a298a70ff38244d62446ba5a9cbfe695fdacf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Wed, 28 Aug 2024 17:48:51 +0800 Subject: [PATCH] release: 2.2.20 --- manifest.json | 2 +- package.json | 2 +- src/common/version.ts | 2 +- src/core/apis/group.ts | 5 ---- src/core/services/NodeIKernelGroupService.ts | 20 +++++----------- src/onebot/action/extends/GetGroupInfoEx.ts | 24 ++++++++++++++++++++ src/onebot/action/index.ts | 2 ++ src/onebot/action/types.ts | 1 + src/onebot/config/onebot11.json | 2 +- src/webui/ui/NapCat.ts | 2 +- static/assets/renderer.js | 2 +- 11 files changed, 39 insertions(+), 25 deletions(-) create mode 100644 src/onebot/action/extends/GetGroupInfoEx.ts diff --git a/manifest.json b/manifest.json index bf8cd4147..12c9dbdd8 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "NapCatQQ", "slug": "NapCat.Framework", "description": "高性能的 OneBot 11 协议实现", - "version": "2.2.19", + "version": "2.2.20", "icon": "./logo.png", "authors": [ { diff --git a/package.json b/package.json index 9a402d012..fa7bb8fa5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "napcat", "private": true, "type": "module", - "version": "2.2.19", + "version": "2.2.20", "scripts": { "build:framework": "vite build --mode framework", "build:shell": "vite build --mode shell", diff --git a/src/common/version.ts b/src/common/version.ts index a9c59dc4d..0b42754f6 100644 --- a/src/common/version.ts +++ b/src/common/version.ts @@ -1 +1 @@ -export const napCatVersion = '2.2.19'; +export const napCatVersion = '2.2.20'; diff --git a/src/core/apis/group.ts b/src/core/apis/group.ts index 508ed540c..bd818ed96 100644 --- a/src/core/apis/group.ts +++ b/src/core/apis/group.ts @@ -33,11 +33,6 @@ export class NTQQGroupApi { } this.context.logger.logDebug(`加载${this.groups.length}个群组缓存完成`); } - async getGroupInfoEx(groupCode: string) { - const groupDetail = await this.context.session.getGroupService().getGroupDetailInfo(groupCode, GroupInfoSource.KDATACARD); - const groupExtInfo = await this.getGroupExtFE0Info([groupCode]); - return { groupDetail, groupExtInfo }; - } async setGroupAvatar(gc: string, filePath: string) { return this.context.session.getGroupService().setHeader(gc, filePath); } diff --git a/src/core/services/NodeIKernelGroupService.ts b/src/core/services/NodeIKernelGroupService.ts index e919234a3..b2f134c5c 100644 --- a/src/core/services/NodeIKernelGroupService.ts +++ b/src/core/services/NodeIKernelGroupService.ts @@ -14,9 +14,9 @@ import { GeneralCallResult } from '@/core/services/common'; //高版本的接口不应该随意使用 使用应该严格进行pr审核 同时部分ipc中未出现的接口不要过于依赖 应该做好数据兜底 export interface NodeIKernelGroupService { - //getGroupExt0xEF0Info(this.$enableGroupCodes, this.$bannedGroupCodes, this.$filter, this.$forceFetch getGroupExt0xEF0Info(enableGroupCodes: string[], bannedGroupCodes: string[], filter: GroupExt0xEF0InfoFilter, forceFetch: boolean): Promise } }>; + kickMemberV2(param: KickMemberV2Req): Promise; quitGroupV2(param: { groupCode: string; needDeleteLocalMsg: boolean; }): Promise; @@ -40,11 +40,11 @@ export interface NodeIKernelGroupService { realSpecialTitleFlag: number }): Promise; - //26702 getGroupMemberLevelInfo(groupCode: string): Promise; - //26702 - getGroupHonorList(groupCodes: Array): unknown; + getGroupInfoForJoinGroup(groupCode: string, needPrivilegeFlag: boolean, serviceType: number): Promise; + + getGroupHonorList(req: { groupCodes: Array }): Promise; getUinByUids(uins: string[]): Promise<{ errCode: number, @@ -58,13 +58,10 @@ export interface NodeIKernelGroupService { uids: Map }>; - //26702(其实更早 但是我不知道) checkGroupMemberCache(arrayList: Array): Promise; - //26702(其实更早 但是我不知道) getGroupLatestEssenceList(groupCode: string): Promise; - //26702(其实更早 但是我不知道) shareDigest(Req: { appId: string, appType: number, @@ -84,20 +81,17 @@ export interface NodeIKernelGroupService { } }): Promise; - //26702(其实更早 但是我不知道) + isEssenceMsg(Req: { groupCode: string, msgRandom: number, msgSeq: number }): Promise; - //26702(其实更早 但是我不知道) queryCachedEssenceMsg(Req: { groupCode: string, msgRandom: number, msgSeq: number }): Promise; - //26702(其实更早 但是我不知道) fetchGroupEssenceList(Req: { groupCode: string, pageStart: number, pageLimit: number }, Arg: unknown): Promise; - //26702 getAllMemberList(groupCode: string, forceFetch: boolean): Promise<{ errCode: number, errMsg: string, @@ -136,8 +130,6 @@ export interface NodeIKernelGroupService { getMemberInfo(group_id: string, uids: string[], forceFetch: boolean): Promise; - //getMemberInfo [ '56729xxxx', [ 'u_4Nj08cwW5Hxxxxx' ], true ] - kickMember(groupCode: string, memberUids: string[], refuseForever: boolean, kickReason: string): Promise; modifyMemberRole(groupCode: string, uid: string, role: GroupMemberRole): void; @@ -152,7 +144,7 @@ export interface NodeIKernelGroupService { getGroupExtList(force: boolean): Promise; - getGroupDetailInfo(groupCode: string, groupInfoSource: GroupInfoSource): unknown; + getGroupDetailInfo(groupCode: string, groupInfoSource: GroupInfoSource): Promise; getMemberExtInfo(param: GroupExtParam): Promise;//req diff --git a/src/onebot/action/extends/GetGroupInfoEx.ts b/src/onebot/action/extends/GetGroupInfoEx.ts new file mode 100644 index 000000000..be5ac71eb --- /dev/null +++ b/src/onebot/action/extends/GetGroupInfoEx.ts @@ -0,0 +1,24 @@ +import BaseAction from '../BaseAction'; +import { ActionName } from '../types'; +import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + +const SchemaData = { + type: 'object', + properties: { + group_id: { type: ['number', 'string'] }, + }, + required: ['group_id'], +} as const satisfies JSONSchema; + +type Payload = FromSchema; + +export class GetGroupInfoEx extends BaseAction { + actionName = ActionName.GetGroupInfoEx; + payloadSchema = SchemaData; + + async _handle(payload: Payload) { + const NTQQGroupApi = this.core.apis.GroupApi; + const groupInfoEx = (await NTQQGroupApi.getGroupExtFE0Info([payload.group_id.toString()])).result.groupExtInfos.get(payload.group_id.toString()); + return groupInfoEx; + } +} diff --git a/src/onebot/action/index.ts b/src/onebot/action/index.ts index 2923dd4ca..7859d7659 100644 --- a/src/onebot/action/index.ts +++ b/src/onebot/action/index.ts @@ -81,11 +81,13 @@ import SetModelShow from './go-cqhttp/SetModelShow'; import { SetInputStatus } from './extends/SetInputStatus'; import { GetCSRF } from './system/GetCSRF'; import { DelGroupNotice } from './group/DelGroupNotice'; +import { GetGroupInfoEx } from './extends/GetGroupInfoEx'; export type ActionMap = Map>; export function createActionMap(obContext: NapCatOneBot11Adapter, core: NapCatCore): ActionMap { const actionHandlers = [ + new GetGroupInfoEx(obContext, core), new FetchEmojiLike(obContext, core), new GetFile(obContext, core), new SetQQProfile(obContext, core), diff --git a/src/onebot/action/types.ts b/src/onebot/action/types.ts index 7eee948c5..053d80dca 100644 --- a/src/onebot/action/types.ts +++ b/src/onebot/action/types.ts @@ -110,4 +110,5 @@ export enum ActionName { SetInputStatus = 'set_input_status', GetCSRF = 'get_csrf_token', DelGroupNotice = '_del_group_notice', + GetGroupInfoEx = "get_group_info_ex" } diff --git a/src/onebot/config/onebot11.json b/src/onebot/config/onebot11.json index 3901fa73e..8ee5a3685 100644 --- a/src/onebot/config/onebot11.json +++ b/src/onebot/config/onebot11.json @@ -1,6 +1,6 @@ { "http": { - "enable": true, + "enable": false, "host": "", "port": 3000, "secret": "", diff --git a/src/webui/ui/NapCat.ts b/src/webui/ui/NapCat.ts index b3d848aa2..73a09ed6c 100644 --- a/src/webui/ui/NapCat.ts +++ b/src/webui/ui/NapCat.ts @@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) { SettingItem( 'Napcat', undefined, - SettingButton('V2.2.19', 'napcat-update-button', 'secondary'), + SettingButton('V2.2.20', 'napcat-update-button', 'secondary'), ), ]), SettingList([ diff --git a/static/assets/renderer.js b/static/assets/renderer.js index 5dde83119..760add0e0 100644 --- a/static/assets/renderer.js +++ b/static/assets/renderer.js @@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) { SettingItem( 'Napcat', void 0, - SettingButton("V2.2.19", "napcat-update-button", "secondary") + SettingButton("V2.2.20", "napcat-update-button", "secondary") ) ]), SettingList([