mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
remove: polyFill
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
"name": "NapCatQQ",
|
"name": "NapCatQQ",
|
||||||
"slug": "NapCat.Framework",
|
"slug": "NapCat.Framework",
|
||||||
"description": "高性能的 OneBot 11 协议实现",
|
"description": "高性能的 OneBot 11 协议实现",
|
||||||
"version": "2.4.7",
|
"version": "2.4.8",
|
||||||
"icon": "./logo.png",
|
"icon": "./logo.png",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"name": "napcat",
|
"name": "napcat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "2.4.7",
|
"version": "2.4.8",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:framework": "vite build --mode framework",
|
"build:framework": "vite build --mode framework",
|
||||||
"build:shell": "vite build --mode shell",
|
"build:shell": "vite build --mode shell",
|
||||||
|
@@ -1 +1 @@
|
|||||||
export const napCatVersion = '2.4.7';
|
export const napCatVersion = '2.4.8';
|
||||||
|
@@ -262,6 +262,23 @@ export class NTQQGroupApi {
|
|||||||
}
|
}
|
||||||
return member;
|
return member;
|
||||||
}
|
}
|
||||||
|
async searchGroup(groupCode: string) {
|
||||||
|
const [, ret] = await this.core.eventWrapper.callNormalEventV2(
|
||||||
|
'NodeIKernelSearchService/searchGroup',
|
||||||
|
'NodeIKernelSearchListener/onSearchGroupResult',
|
||||||
|
[{
|
||||||
|
keyWords: groupCode,
|
||||||
|
groupNum: 25,
|
||||||
|
exactSearch: false,
|
||||||
|
penetrate: ''
|
||||||
|
}],
|
||||||
|
(ret) => ret.result === 0,
|
||||||
|
(params) => !!params.groupInfos.find(g => g.groupCode === groupCode),
|
||||||
|
1,
|
||||||
|
5000
|
||||||
|
);
|
||||||
|
return ret.groupInfos.find(g => g.groupCode === groupCode);
|
||||||
|
}
|
||||||
async getGroupMemberEx(GroupCode: string, uid: string, forced = false, retry = 2) {
|
async getGroupMemberEx(GroupCode: string, uid: string, forced = false, retry = 2) {
|
||||||
const data = await solveAsyncProblem((eventWrapper: NTEventWrapper, GroupCode: string, uid: string, forced = false) => {
|
const data = await solveAsyncProblem((eventWrapper: NTEventWrapper, GroupCode: string, uid: string, forced = false) => {
|
||||||
return eventWrapper.callNormalEventV2(
|
return eventWrapper.callNormalEventV2(
|
||||||
|
97
src/core/listeners/NodeIKernelSearchListener.ts
Normal file
97
src/core/listeners/NodeIKernelSearchListener.ts
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
import { ChatType } from '@/core';
|
||||||
|
export interface SearchGroupInfo {
|
||||||
|
groupCode: string;
|
||||||
|
ownerUid: string;
|
||||||
|
groupFlag: number;
|
||||||
|
groupFlagExt: number;
|
||||||
|
maxMemberNum: number;
|
||||||
|
memberNum: number;
|
||||||
|
groupOption: number;
|
||||||
|
classExt: number;
|
||||||
|
groupName: string;
|
||||||
|
fingerMemo: string;
|
||||||
|
groupQuestion: string;
|
||||||
|
certType: number;
|
||||||
|
shutUpAllTimestamp: number;
|
||||||
|
shutUpMeTimestamp: number;
|
||||||
|
groupTypeFlag: number;
|
||||||
|
privilegeFlag: number;
|
||||||
|
groupSecLevel: number;
|
||||||
|
groupFlagExt3: number;
|
||||||
|
isConfGroup: number;
|
||||||
|
isModifyConfGroupFace: number;
|
||||||
|
isModifyConfGroupName: number;
|
||||||
|
noFigerOpenFlag: number;
|
||||||
|
noCodeFingerOpenFlag: number;
|
||||||
|
groupFlagExt4: number;
|
||||||
|
groupMemo: string;
|
||||||
|
cmdUinMsgSeq: number;
|
||||||
|
cmdUinJoinTime: number;
|
||||||
|
cmdUinUinFlag: number;
|
||||||
|
cmdUinMsgMask: number;
|
||||||
|
groupSecLevelInfo: number;
|
||||||
|
cmdUinPrivilege: number;
|
||||||
|
cmdUinFlagEx2: number;
|
||||||
|
appealDeadline: number;
|
||||||
|
remarkName: string;
|
||||||
|
isTop: boolean;
|
||||||
|
richFingerMemo: string;
|
||||||
|
groupAnswer: string;
|
||||||
|
joinGroupAuth: string;
|
||||||
|
isAllowModifyConfGroupName: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GroupInfo {
|
||||||
|
groupCode: string;
|
||||||
|
searchGroupInfo: SearchGroupInfo;
|
||||||
|
privilege: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GroupSearchResult {
|
||||||
|
keyWord: string;
|
||||||
|
errorCode: number;
|
||||||
|
groupInfos: GroupInfo[];
|
||||||
|
penetrate: string;
|
||||||
|
isEnd: boolean;
|
||||||
|
nextPos: number;
|
||||||
|
}
|
||||||
|
export interface NodeIKernelSearchListener {
|
||||||
|
|
||||||
|
onSearchGroupResult(params: GroupSearchResult): void;
|
||||||
|
|
||||||
|
onSearchFileKeywordsResult(params: {
|
||||||
|
searchId: string,
|
||||||
|
hasMore: boolean,
|
||||||
|
resultItems: {
|
||||||
|
chatType: ChatType,
|
||||||
|
buddyChatInfo: any[],
|
||||||
|
discussChatInfo: any[],
|
||||||
|
groupChatInfo: {
|
||||||
|
groupCode: string,
|
||||||
|
isConf: boolean,
|
||||||
|
hasModifyConfGroupFace: boolean,
|
||||||
|
hasModifyConfGroupName: boolean,
|
||||||
|
groupName: string,
|
||||||
|
remark: string
|
||||||
|
}[],
|
||||||
|
dataLineChatInfo: any[],
|
||||||
|
tmpChatInfo: any[],
|
||||||
|
msgId: string,
|
||||||
|
msgSeq: string,
|
||||||
|
msgTime: string,
|
||||||
|
senderUid: string,
|
||||||
|
senderNick: string,
|
||||||
|
senderRemark: string,
|
||||||
|
senderCard: string,
|
||||||
|
elemId: string,
|
||||||
|
elemType: number,
|
||||||
|
fileSize: string,
|
||||||
|
filePath: string,
|
||||||
|
fileName: string,
|
||||||
|
hits: {
|
||||||
|
start: number,
|
||||||
|
end: number
|
||||||
|
}[]
|
||||||
|
}[]
|
||||||
|
}): void;
|
||||||
|
}
|
@@ -1,39 +0,0 @@
|
|||||||
import { ChatType } from '@/core';
|
|
||||||
|
|
||||||
export interface NodeIKernelSearchListener_Polyfill {
|
|
||||||
onSearchFileKeywordsResult(params: {
|
|
||||||
searchId: string,
|
|
||||||
hasMore: boolean,
|
|
||||||
resultItems: {
|
|
||||||
chatType: ChatType,
|
|
||||||
buddyChatInfo: any[],
|
|
||||||
discussChatInfo: any[],
|
|
||||||
groupChatInfo: {
|
|
||||||
groupCode: string,
|
|
||||||
isConf: boolean,
|
|
||||||
hasModifyConfGroupFace: boolean,
|
|
||||||
hasModifyConfGroupName: boolean,
|
|
||||||
groupName: string,
|
|
||||||
remark: string
|
|
||||||
}[],
|
|
||||||
dataLineChatInfo: any[],
|
|
||||||
tmpChatInfo: any[],
|
|
||||||
msgId: string,
|
|
||||||
msgSeq: string,
|
|
||||||
msgTime: string,
|
|
||||||
senderUid: string,
|
|
||||||
senderNick: string,
|
|
||||||
senderRemark: string,
|
|
||||||
senderCard: string,
|
|
||||||
elemId: string,
|
|
||||||
elemType: number,
|
|
||||||
fileSize: string,
|
|
||||||
filePath: string,
|
|
||||||
fileName: string,
|
|
||||||
hits: {
|
|
||||||
start: number,
|
|
||||||
end: number
|
|
||||||
}[]
|
|
||||||
}[]
|
|
||||||
}): void;
|
|
||||||
}
|
|
@@ -9,7 +9,7 @@ export * from './NodeIKernelProfileListener';
|
|||||||
export * from './NodeIKernelTicketListener';
|
export * from './NodeIKernelTicketListener';
|
||||||
export * from './NodeIKernelStorageCleanListener';
|
export * from './NodeIKernelStorageCleanListener';
|
||||||
export * from './NodeIKernelFileAssistantListener';
|
export * from './NodeIKernelFileAssistantListener';
|
||||||
export * from './NodeIKernelSearchListener_Polyfill';
|
export * from './NodeIKernelSearchListener';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
NodeIKernelBuddyListener,
|
NodeIKernelBuddyListener,
|
||||||
@@ -19,11 +19,11 @@ import type {
|
|||||||
NodeIKernelMsgListener,
|
NodeIKernelMsgListener,
|
||||||
NodeIKernelProfileListener,
|
NodeIKernelProfileListener,
|
||||||
NodeIKernelRobotListener,
|
NodeIKernelRobotListener,
|
||||||
NodeIKernelSearchListener_Polyfill,
|
|
||||||
NodeIKernelSessionListener,
|
NodeIKernelSessionListener,
|
||||||
NodeIKernelStorageCleanListener,
|
NodeIKernelStorageCleanListener,
|
||||||
NodeIKernelTicketListener,
|
NodeIKernelTicketListener,
|
||||||
} from '.';
|
} from '.';
|
||||||
|
import { NodeIKernelSearchListener } from './NodeIKernelSearchListener';
|
||||||
|
|
||||||
export type ListenerNamingMapping = {
|
export type ListenerNamingMapping = {
|
||||||
NodeIKernelSessionListener: NodeIKernelSessionListener;
|
NodeIKernelSessionListener: NodeIKernelSessionListener;
|
||||||
@@ -36,5 +36,5 @@ export type ListenerNamingMapping = {
|
|||||||
NodeIKernelTicketListener: NodeIKernelTicketListener;
|
NodeIKernelTicketListener: NodeIKernelTicketListener;
|
||||||
NodeIKernelStorageCleanListener: NodeIKernelStorageCleanListener;
|
NodeIKernelStorageCleanListener: NodeIKernelStorageCleanListener;
|
||||||
NodeIKernelFileAssistantListener: NodeIKernelFileAssistantListener;
|
NodeIKernelFileAssistantListener: NodeIKernelFileAssistantListener;
|
||||||
NodeIKernelSearchListener: NodeIKernelSearchListener_Polyfill;
|
NodeIKernelSearchListener: NodeIKernelSearchListener;
|
||||||
};
|
};
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { ChatType } from '../entities';
|
import { ChatType } from '../entities';
|
||||||
|
import { GeneralCallResult } from './common';
|
||||||
|
|
||||||
export interface NodeIKernelSearchService {
|
export interface NodeIKernelSearchService {
|
||||||
|
|
||||||
@@ -8,7 +9,12 @@ export interface NodeIKernelSearchService {
|
|||||||
|
|
||||||
searchStranger(unknown: string, searchStranger: unknown, searchParams: unknown): Promise<unknown>;
|
searchStranger(unknown: string, searchStranger: unknown, searchParams: unknown): Promise<unknown>;
|
||||||
|
|
||||||
searchGroup(...args: any[]): unknown;// needs 1 arguments
|
searchGroup(param: {
|
||||||
|
keyWords: string,
|
||||||
|
groupNum: number,
|
||||||
|
exactSearch: boolean,
|
||||||
|
penetrate: string
|
||||||
|
}): Promise<GeneralCallResult>;// needs 1 arguments
|
||||||
|
|
||||||
searchLocalInfo(keywords: string, unknown: number/*4*/): unknown;
|
searchLocalInfo(keywords: string, unknown: number/*4*/): unknown;
|
||||||
|
|
||||||
|
@@ -20,7 +20,17 @@ class GetGroupInfo extends BaseAction<Payload, OB11Group> {
|
|||||||
|
|
||||||
async _handle(payload: Payload) {
|
async _handle(payload: Payload) {
|
||||||
const group = (await this.core.apis.GroupApi.getGroups()).find(e => e.groupCode == payload.group_id.toString());
|
const group = (await this.core.apis.GroupApi.getGroups()).find(e => e.groupCode == payload.group_id.toString());
|
||||||
if (!group) throw `群${payload.group_id}不存在`;
|
if (!group) {
|
||||||
|
const data = await this.core.apis.GroupApi.searchGroup(payload.group_id.toString());
|
||||||
|
if (!data) throw new Error('Group not found');
|
||||||
|
return {
|
||||||
|
...data.searchGroupInfo,
|
||||||
|
group_id: +payload.group_id,
|
||||||
|
group_name: data.searchGroupInfo.groupName,
|
||||||
|
member_count: data.searchGroupInfo.memberNum,
|
||||||
|
max_member_count: data.searchGroupInfo.maxMemberNum,
|
||||||
|
}
|
||||||
|
}
|
||||||
return OB11Entities.group(group);
|
return OB11Entities.group(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
'<span id="napcat-update-title">Napcat</span>',
|
'<span id="napcat-update-title">Napcat</span>',
|
||||||
undefined,
|
undefined,
|
||||||
SettingButton('V2.4.7', 'napcat-update-button', 'secondary'),
|
SettingButton('V2.4.8', 'napcat-update-button', 'secondary'),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
@@ -164,7 +164,7 @@ async function onSettingWindowCreated(view) {
|
|||||||
SettingItem(
|
SettingItem(
|
||||||
'<span id="napcat-update-title">Napcat</span>',
|
'<span id="napcat-update-title">Napcat</span>',
|
||||||
void 0,
|
void 0,
|
||||||
SettingButton("V2.4.7", "napcat-update-button", "secondary")
|
SettingButton("V2.4.8", "napcat-update-button", "secondary")
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
SettingList([
|
SettingList([
|
||||||
|
Reference in New Issue
Block a user