diff --git a/src/common/framework/event-legacy.ts b/src/common/framework/event-legacy.ts index a9e3e7ff..136ead80 100644 --- a/src/common/framework/event-legacy.ts +++ b/src/common/framework/event-legacy.ts @@ -1,5 +1,5 @@ -import { NodeIQQNTWrapperSession } from "@/core/wrapper/wrapper"; -import { randomUUID } from "crypto"; +import { NodeIQQNTWrapperSession } from '@/core/wrapper/wrapper'; +import { randomUUID } from 'crypto'; interface Internal_MapKey { timeout: number; @@ -23,7 +23,7 @@ export class LegacyNTEventWrapper { constructor( listenerMapping: Record, - wrapperSession: NodeIQQNTWrapperSession + wrapperSession: NodeIQQNTWrapperSession, ) { this.listenerMapping = listenerMapping; this.WrapperSession = wrapperSession; @@ -37,7 +37,7 @@ export class LegacyNTEventWrapper { { get(target: any, prop: any, receiver: any) { // console.log('get', prop, typeof target[prop]); - if (typeof target[prop] === "undefined") { + if (typeof target[prop] === 'undefined') { // 如果方法不存在,返回一个函数,这个函数调用existentMethod return (...args: any[]) => { current.dispatcherListener.apply(current, [ListenerMainName, prop, ...args]).then(); @@ -46,17 +46,17 @@ export class LegacyNTEventWrapper { // 如果方法存在,正常返回 return Reflect.get(target, prop, receiver); }, - } + }, ); } createEventFunction any>(eventName: string): T | undefined { - const eventNameArr = eventName.split("/"); + const eventNameArr = eventName.split('/'); type eventType = { [key: string]: () => { [key: string]: (...params: Parameters) => Promise> }; }; if (eventNameArr.length > 1) { - const serviceName = "get" + eventNameArr[0].replace("NodeIKernel", ""); + const serviceName = 'get' + eventNameArr[0].replace('NodeIKernel', ''); const eventName = eventNameArr[1]; //getNodeIKernelGroupListener,GroupService //console.log('2', eventName); @@ -71,13 +71,13 @@ export class LegacyNTEventWrapper { } } - createListenerFunction(listenerMainName: string, uniqueCode: string = ""): T { + createListenerFunction(listenerMainName: string, uniqueCode: string = ''): T { const ListenerType = this.listenerMapping![listenerMainName]; let Listener = this.listenerManager.get(listenerMainName + uniqueCode); if (!Listener && ListenerType) { Listener = new ListenerType(this.createProxyDispatch(listenerMainName)); const ServiceSubName = listenerMainName.match(/^NodeIKernel(.*?)Listener$/)![1]; - const Service = "NodeIKernel" + ServiceSubName + "Service/addKernel" + ServiceSubName + "Listener"; + const Service = 'NodeIKernel' + ServiceSubName + 'Service/addKernel' + ServiceSubName + 'Listener'; const addfunc = this.createEventFunction<(listener: T) => number>(Service); addfunc!(Listener as T); //console.log(addfunc!(Listener as T)); @@ -104,7 +104,7 @@ export class LegacyNTEventWrapper { } async callNoListenerEvent Promise | any>( - EventName = "", + EventName = '', timeout: number = 3000, ...args: Parameters ) { @@ -113,7 +113,7 @@ export class LegacyNTEventWrapper { let complete = false; setTimeout(() => { if (!complete) { - reject(new Error("NTEvent EventName:" + EventName + " timeout")); + reject(new Error('NTEvent EventName:' + EventName + ' timeout')); } }, timeout); const retData = await EventFunc!(...args); @@ -123,13 +123,13 @@ export class LegacyNTEventWrapper { } async RegisterListen void>( - ListenerName = "", + ListenerName = '', waitTimes = 1, timeout = 5000, - checker: (...args: Parameters) => boolean + checker: (...args: Parameters) => boolean, ) { return new Promise>((resolve, reject) => { - const ListenerNameList = ListenerName.split("/"); + const ListenerNameList = ListenerName.split('/'); const ListenerMainName = ListenerNameList[0]; const ListenerSubName = ListenerNameList[1]; const id = randomUUID(); @@ -137,7 +137,7 @@ export class LegacyNTEventWrapper { let retData: Parameters | undefined = undefined; const databack = () => { if (complete == 0) { - reject(new Error(" ListenerName:" + ListenerName + " timeout")); + reject(new Error(' ListenerName:' + ListenerName + ' timeout')); } else { resolve(retData!); } @@ -166,12 +166,13 @@ export class LegacyNTEventWrapper { this.createListenerFunction(ListenerMainName); }); } + async CallNormalEvent< EventType extends (...args: any[]) => Promise, ListenerType extends (...args: any[]) => void >( - EventName = "", - ListenerName = "", + EventName = '', + ListenerName = '', waitTimes = 1, timeout: number = 3000, checker: (...args: Parameters) => boolean, @@ -187,21 +188,21 @@ export class LegacyNTEventWrapper { if (complete == 0) { reject( new Error( - "Timeout: NTEvent EventName:" + - EventName + - " ListenerName:" + - ListenerName + - " EventRet:\n" + - JSON.stringify(retEvent, null, 4) + - "\n" - ) + 'Timeout: NTEvent EventName:' + + EventName + + ' ListenerName:' + + ListenerName + + ' EventRet:\n' + + JSON.stringify(retEvent, null, 4) + + '\n', + ), ); } else { resolve([retEvent as Awaited>, ...retData!]); } }; - const ListenerNameList = ListenerName.split("/"); + const ListenerNameList = ListenerName.split('/'); const ListenerMainName = ListenerNameList[0]; const ListenerSubName = ListenerNameList[1]; @@ -231,7 +232,7 @@ export class LegacyNTEventWrapper { this.createListenerFunction(ListenerMainName); const EventFunc = this.createEventFunction(EventName); retEvent = await EventFunc!(...(args as any[])); - } + }, ); } } diff --git a/src/common/framework/event.ts b/src/common/framework/event.ts index 6e769c79..41db0ab0 100644 --- a/src/common/framework/event.ts +++ b/src/common/framework/event.ts @@ -1,5 +1,5 @@ -import type { NodeIQQNTWrapperSession, WrapperNodeApi } from "@/core/wrapper/wrapper"; -import EventEmitter from "node:events"; +import type { NodeIQQNTWrapperSession, WrapperNodeApi } from '@/core/wrapper/wrapper'; +import EventEmitter from 'node:events'; export type ListenerClassBase = Record; @@ -12,9 +12,11 @@ export class NTEventChannel extends EventEmitter { private wrapperApi: WrapperNodeApi; private wrapperSession: NodeIQQNTWrapperSession; private listenerRefStorage = new Map(); + constructor(WrapperApi: WrapperNodeApi, WrapperSession: NodeIQQNTWrapperSession) { super(); - this.on('error', () => { }); + this.on('error', () => { + }); this.wrapperApi = WrapperApi; this.wrapperSession = WrapperSession; } @@ -31,7 +33,7 @@ export class NTEventChannel extends EventEmitter { return (...args: any[]) => { current.dispatcherListener.apply(current, [ListenerMainName + '/' + prop, ...args]); }; - } + }, }); } @@ -109,7 +111,7 @@ export class NTEventChannel extends EventEmitter { //console.log('2', eventName); const services = (this.wrapperSession as unknown as eventType)[serviceName](); const event = services[eventName] - //重新绑定this + //重新绑定this .bind(services); if (event) { return event as T; @@ -134,4 +136,5 @@ export class NTEventChannel extends EventEmitter { }); } } -//NTEvent2.0 \ No newline at end of file + +//NTEvent2.0 diff --git a/src/common/framework/napcat.ts b/src/common/framework/napcat.ts index 1551d14c..19b70d91 100644 --- a/src/common/framework/napcat.ts +++ b/src/common/framework/napcat.ts @@ -1,6 +1,8 @@ -import path, { dirname } from "path"; -import { fileURLToPath } from "url"; -export const napcat_version = "2.0.0"; +import path, { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +export const napcat_version = '2.0.0'; + export class NapCatPathWrapper { binaryPath: string; logsPath: string; @@ -8,7 +10,7 @@ export class NapCatPathWrapper { constructor(mainPath: string = dirname(fileURLToPath(import.meta.url))) { this.binaryPath = mainPath; - this.logsPath = path.join(this.binaryPath, "logs"); - this.configPath = path.join(this.binaryPath, "config"); + this.logsPath = path.join(this.binaryPath, 'logs'); + this.configPath = path.join(this.binaryPath, 'config'); } } diff --git a/src/common/utils/ConfigBase.ts b/src/common/utils/ConfigBase.ts index 0304c347..3f4ca9d4 100644 --- a/src/common/utils/ConfigBase.ts +++ b/src/common/utils/ConfigBase.ts @@ -1,86 +1,91 @@ import path from 'node:path'; import fs from 'node:fs'; import type { NapCatCore } from '@/core'; + export class ConfigBase { - public name: string = 'default_config'; - private pathName: string | null = null; // 本次读取的文件路径 - coreContext: NapCatCore; - configPath: string; - config: { [key: string]: any } = {}; - constructor(coreContext: NapCatCore, configPath: string) { - this.coreContext = coreContext; - this.configPath = configPath; - this.read(); - } + public name: string = 'default_config'; + private pathName: string | null = null; // 本次读取的文件路径 + coreContext: NapCatCore; + configPath: string; + config: { [key: string]: any } = {}; - protected getKeys(): string[] | null { - // 决定 key 在json配置文件中的顺序 - return null; - } - - getConfigDir() { - const configDir = path.resolve(this.configPath, 'config'); - fs.mkdirSync(configDir, { recursive: true }); - return configDir; - } - getConfigPath(pathName: string | null): string { - const suffix = pathName ? `_${pathName}` : ''; - const filename = `${this.name}${suffix}.json`; - return path.join(this.getConfigDir(), filename); - } - read() { - // 尝试加载当前账号配置 - if (this.read_from_file(this.coreContext.selfInfo.uin, false)) return this; - // 尝试加载默认配置 - return this.read_from_file('', true); - } - getConfig(): T { - return this.config as T; - } - read_from_file(pathName: string, createIfNotExist: boolean) { - const logger = this.coreContext.context.logger; - const configPath = this.getConfigPath(pathName); - if (!fs.existsSync(configPath)) { - if (!createIfNotExist) return null; - this.pathName = pathName; // 记录有效的设置文件 - try { - fs.writeFileSync(configPath, JSON.stringify(this.config, this.getKeys(), 2)); - logger.log(`配置文件${configPath}已创建\n如果修改此文件后需要重启 NapCat 生效`); - } - catch (e: any) { - logger.logError(`创建配置文件 ${configPath} 时发生错误:`, e.message); - } - return this.config; + constructor(coreContext: NapCatCore, configPath: string) { + this.coreContext = coreContext; + this.configPath = configPath; + this.read(); } - try { - this.config = JSON.parse(fs.readFileSync(configPath, 'utf-8')); - logger.logDebug(`配置文件${configPath}已加载`, this.config); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - this.save(); // 保存一次,让新版本的字段写入 - return this.config; - } catch (e: any) { - if (e instanceof SyntaxError) { - logger.logError(`配置文件 ${configPath} 格式错误,请检查配置文件:`, e.message); - } else { - logger.logError(`读取配置文件 ${configPath} 时发生错误:`, e.message); - } - return {}; + protected getKeys(): string[] | null { + // 决定 key 在json配置文件中的顺序 + return null; } - } - save(configData: T = this.config as T, overwrite: boolean = false) { - const logger = this.coreContext.context.logger; - const selfInfo = this.coreContext.selfInfo; - if (overwrite) { - // 用户要求强制写入,则变更当前文件为目标文件 - this.pathName = `${selfInfo.uin}`; + getConfigDir() { + const configDir = path.resolve(this.configPath, 'config'); + fs.mkdirSync(configDir, { recursive: true }); + return configDir; } - const configPath = this.getConfigPath(this.pathName); - try { - fs.writeFileSync(configPath, JSON.stringify(configData, this.getKeys(), 2)); - } catch (e: any) { - logger.logError(`保存配置文件 ${configPath} 时发生错误:`, e.message); + + getConfigPath(pathName: string | null): string { + const suffix = pathName ? `_${pathName}` : ''; + const filename = `${this.name}${suffix}.json`; + return path.join(this.getConfigDir(), filename); + } + + read() { + // 尝试加载当前账号配置 + if (this.read_from_file(this.coreContext.selfInfo.uin, false)) return this; + // 尝试加载默认配置 + return this.read_from_file('', true); + } + + getConfig(): T { + return this.config as T; + } + + read_from_file(pathName: string, createIfNotExist: boolean) { + const logger = this.coreContext.context.logger; + const configPath = this.getConfigPath(pathName); + if (!fs.existsSync(configPath)) { + if (!createIfNotExist) return null; + this.pathName = pathName; // 记录有效的设置文件 + try { + fs.writeFileSync(configPath, JSON.stringify(this.config, this.getKeys(), 2)); + logger.log(`配置文件${configPath}已创建\n如果修改此文件后需要重启 NapCat 生效`); + } catch (e: any) { + logger.logError(`创建配置文件 ${configPath} 时发生错误:`, e.message); + } + return this.config; + } + + try { + this.config = JSON.parse(fs.readFileSync(configPath, 'utf-8')); + logger.logDebug(`配置文件${configPath}已加载`, this.config); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + this.save(); // 保存一次,让新版本的字段写入 + return this.config; + } catch (e: any) { + if (e instanceof SyntaxError) { + logger.logError(`配置文件 ${configPath} 格式错误,请检查配置文件:`, e.message); + } else { + logger.logError(`读取配置文件 ${configPath} 时发生错误:`, e.message); + } + return {}; + } + } + + save(configData: T = this.config as T, overwrite: boolean = false) { + const logger = this.coreContext.context.logger; + const selfInfo = this.coreContext.selfInfo; + if (overwrite) { + // 用户要求强制写入,则变更当前文件为目标文件 + this.pathName = `${selfInfo.uin}`; + } + const configPath = this.getConfigPath(this.pathName); + try { + fs.writeFileSync(configPath, JSON.stringify(configData, this.getKeys(), 2)); + } catch (e: any) { + logger.logError(`保存配置文件 ${configPath} 时发生错误:`, e.message); + } } - } } diff --git a/src/common/utils/MessageUnique.ts b/src/common/utils/MessageUnique.ts index cdbda9a0..bd4b5fab 100644 --- a/src/common/utils/MessageUnique.ts +++ b/src/common/utils/MessageUnique.ts @@ -1,5 +1,6 @@ import { Peer } from '@/core'; import crypto from 'crypto'; + export class LimitedHashTable { private keyToValue: Map = new Map(); private valueToKey: Map = new Map(); @@ -8,15 +9,16 @@ export class LimitedHashTable { constructor(maxSize: number) { this.maxSize = maxSize; } + resize(count: number) { this.maxSize = count; } set(key: K, value: V): void { - // const isExist = this.keyToValue.get(key); - // if (isExist && isExist === value) { - // return; - // } + // const isExist = this.keyToValue.get(key); + // if (isExist && isExist === value) { + // return; + // } this.keyToValue.set(key, value); this.valueToKey.set(value, key); while (this.keyToValue.size !== this.valueToKey.size) { @@ -63,6 +65,7 @@ export class LimitedHashTable { getKeyList(): K[] { return Array.from(this.keyToValue.keys()); } + //获取最近刚写入的几个值 getHeads(size: number): { key: K; value: V }[] | undefined { const keyList = this.getKeyList(); @@ -82,10 +85,12 @@ export class LimitedHashTable { class MessageUniqueWrapper { private msgDataMap: LimitedHashTable; private msgIdMap: LimitedHashTable; + constructor(maxMap: number = 1000) { this.msgIdMap = new LimitedHashTable(maxMap); this.msgDataMap = new LimitedHashTable(maxMap); } + getRecentMsgIds(Peer: Peer, size: number): string[] { const heads = this.msgIdMap.getHeads(size); if (!heads) { @@ -95,6 +100,7 @@ class MessageUniqueWrapper { const ret = data.filter((t) => t?.Peer.chatType === Peer.chatType && t?.Peer.peerUid === Peer.peerUid); return ret.map((t) => t?.MsgId).filter((t) => t !== undefined); } + createMsg(peer: Peer, msgId: string): number | undefined { const key = `${msgId}|${peer.chatType}|${peer.peerUid}`; const hash = crypto.createHash('md5').update(key).digest(); @@ -128,11 +134,13 @@ class MessageUniqueWrapper { getShortIdByMsgId(msgId: string): number | undefined { return this.msgIdMap.getValue(msgId); } + getPeerByMsgId(msgId: string) { const shortId = this.msgIdMap.getValue(msgId); if (!shortId) return undefined; return this.getMsgIdAndPeerByShortId(shortId); } + resize(maxSize: number): void { this.msgIdMap.resize(maxSize); this.msgDataMap.resize(maxSize); diff --git a/src/common/utils/QQBasicInfo.ts b/src/common/utils/QQBasicInfo.ts index c9270514..86cc6239 100644 --- a/src/common/utils/QQBasicInfo.ts +++ b/src/common/utils/QQBasicInfo.ts @@ -1,9 +1,9 @@ -import path from "node:path"; -import fs from "node:fs"; -import { systemPlatform } from "@/common/utils/system"; -import { getDefaultQQVersionConfigInfo, getQQVersionConfigPath } from "./helper"; -import AppidTable from "@/core/external/appid.json"; -import { LogWrapper } from "./log"; +import path from 'node:path'; +import fs from 'node:fs'; +import { systemPlatform } from '@/common/utils/system'; +import { getDefaultQQVersionConfigInfo, getQQVersionConfigPath } from './helper'; +import AppidTable from '@/core/external/appid.json'; +import { LogWrapper } from './log'; export class QQBasicInfoWrapper { QQMainPath: string | undefined; @@ -20,7 +20,7 @@ export class QQBasicInfoWrapper { //基础目录获取 this.context = context; this.QQMainPath = process.execPath; - this.QQPackageInfoPath = path.join(path.dirname(this.QQMainPath), "resources", "app", "package.json"); + this.QQPackageInfoPath = path.join(path.dirname(this.QQMainPath), 'resources', 'app', 'package.json'); this.QQVersionConfigPath = getQQVersionConfigPath(this.QQMainPath); //基础信息获取 无快更则启用默认模板填充 @@ -40,27 +40,29 @@ export class QQBasicInfoWrapper { } getFullQQVesion() { - const version = this.isQuickUpdate ? this.QQVersionConfig?.curVersion : this.QQPackageInfo?.version; - if(!version) throw new Error("QQ版本获取失败"); + const version = this.isQuickUpdate ? this.QQVersionConfig?.curVersion : this.QQPackageInfo?.version; + if (!version) throw new Error('QQ版本获取失败'); return version; } requireMinNTQQBuild(buildStr: string) { - const currentBuild = parseInt(this.getQQBuildStr() || "0"); - if (currentBuild == 0) throw new Error("QQBuildStr获取失败"); + const currentBuild = parseInt(this.getQQBuildStr() || '0'); + if (currentBuild == 0) throw new Error('QQBuildStr获取失败'); return currentBuild >= parseInt(buildStr); } + //此方法不要直接使用 getQUAInternal() { - return systemPlatform === "linux" + return systemPlatform === 'linux' ? `V1_LNX_NQ_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B` : `V1_WIN_NQ_${this.getFullQQVesion()}_${this.getQQBuildStr()}_GW_B`; } + getAppidV2(): { appid: string; qua: string } { const appidTbale = AppidTable as unknown as QQAppidTableType; try { const fullVersion = this.getFullQQVesion(); - if (!fullVersion) throw new Error("QQ版本获取失败"); + if (!fullVersion) throw new Error('QQ版本获取失败'); const data = appidTbale[fullVersion]; if (data) { return data; @@ -70,9 +72,10 @@ export class QQBasicInfoWrapper { } // 以下是兜底措施 this.context.logger.log( - `[QQ版本兼容性检测] ${this.getFullQQVesion()} 版本兼容性不佳,可能会导致一些功能无法正常使用` + `[QQ版本兼容性检测] ${this.getFullQQVesion()} 版本兼容性不佳,可能会导致一些功能无法正常使用`, ); - return { appid: systemPlatform === "linux" ? "537237950" : "537237765", qua: this.getQUAInternal() }; + return { appid: systemPlatform === 'linux' ? '537237950' : '537237765', qua: this.getQUAInternal() }; } } + export let QQBasicInfo: QQBasicInfoWrapper | undefined; diff --git a/src/common/utils/audio.ts b/src/common/utils/audio.ts index d9f7308d..c37c3442 100644 --- a/src/common/utils/audio.ts +++ b/src/common/utils/audio.ts @@ -1,88 +1,90 @@ import fs from 'fs'; -import { encode, getDuration, getWavFileInfo, isWav, isSilk } from 'silk-wasm'; +import { encode, getDuration, getWavFileInfo, isSilk, isWav } from 'silk-wasm'; import fsPromise from 'fs/promises'; import path from 'node:path'; import { randomUUID } from 'crypto'; import { spawn } from 'node:child_process'; import { LogWrapper } from './log'; -export async function encodeSilk(filePath: string, TEMP_DIR: string, logger: LogWrapper) { - async function guessDuration(pttPath: string) { - const pttFileInfo = await fsPromise.stat(pttPath); - let duration = pttFileInfo.size / 1024 / 3; // 3kb/s - duration = Math.floor(duration); - duration = Math.max(1, duration); - logger.log('通过文件大小估算语音的时长:', duration); - return duration; - } - try { - const file = await fsPromise.readFile(filePath); - const pttPath = path.join(TEMP_DIR, randomUUID()); - if (!isSilk(file)) { - logger.log(`语音文件${filePath}需要转换成silk`); - const _isWav = isWav(file); - const pcmPath = pttPath + '.pcm'; - let sampleRate = 0; - const convert = () => { - return new Promise((resolve, reject) => { - // todo: 通过配置文件获取ffmpeg路径 - const ffmpegPath = process.env.FFMPEG_PATH || 'ffmpeg'; - const cp = spawn(ffmpegPath, ['-y', '-i', filePath, '-ar', '24000', '-ac', '1', '-f', 's16le', pcmPath]); - cp.on('error', err => { - logger.log('FFmpeg处理转换出错: ', err.message); - return reject(err); - }); - cp.on('exit', (code, signal) => { - const EXIT_CODES = [0, 255]; - if (code == null || EXIT_CODES.includes(code)) { - sampleRate = 24000; - const data = fs.readFileSync(pcmPath); - fs.unlink(pcmPath, (err) => { - }); - return resolve(data); - } - logger.log(`FFmpeg exit: code=${code ?? 'unknown'} sig=${signal ?? 'unknown'}`); - reject(Error('FFmpeg处理转换失败')); - }); - }); - }; - let input: Buffer; - if (!_isWav) { - input = await convert(); - } else { - input = file; - const allowSampleRate = [8000, 12000, 16000, 24000, 32000, 44100, 48000]; - const { fmt } = getWavFileInfo(input); - // log(`wav文件信息`, fmt) - if (!allowSampleRate.includes(fmt.sampleRate)) { - input = await convert(); - } - } - const silk = await encode(input, sampleRate); - fs.writeFileSync(pttPath, silk.data); - logger.log(`语音文件${filePath}转换成功!`, pttPath, '时长:', silk.duration); - return { - converted: true, - path: pttPath, - duration: silk.duration / 1000 - }; - } else { - const silk = file; - let duration = 0; - try { - duration = getDuration(silk) / 1000; - } catch (e: any) { - logger.log('获取语音文件时长失败, 使用文件大小推测时长', filePath, e.stack); - duration = await guessDuration(filePath); - } - return { - converted: false, - path: filePath, - duration, - }; +export async function encodeSilk(filePath: string, TEMP_DIR: string, logger: LogWrapper) { + async function guessDuration(pttPath: string) { + const pttFileInfo = await fsPromise.stat(pttPath); + let duration = pttFileInfo.size / 1024 / 3; // 3kb/s + duration = Math.floor(duration); + duration = Math.max(1, duration); + logger.log('通过文件大小估算语音的时长:', duration); + return duration; + } + + try { + const file = await fsPromise.readFile(filePath); + const pttPath = path.join(TEMP_DIR, randomUUID()); + if (!isSilk(file)) { + logger.log(`语音文件${filePath}需要转换成silk`); + const _isWav = isWav(file); + const pcmPath = pttPath + '.pcm'; + let sampleRate = 0; + const convert = () => { + return new Promise((resolve, reject) => { + // todo: 通过配置文件获取ffmpeg路径 + const ffmpegPath = process.env.FFMPEG_PATH || 'ffmpeg'; + const cp = spawn(ffmpegPath, ['-y', '-i', filePath, '-ar', '24000', '-ac', '1', '-f', 's16le', pcmPath]); + cp.on('error', err => { + logger.log('FFmpeg处理转换出错: ', err.message); + return reject(err); + }); + cp.on('exit', (code, signal) => { + const EXIT_CODES = [0, 255]; + if (code == null || EXIT_CODES.includes(code)) { + sampleRate = 24000; + const data = fs.readFileSync(pcmPath); + fs.unlink(pcmPath, (err) => { + }); + return resolve(data); + } + logger.log(`FFmpeg exit: code=${code ?? 'unknown'} sig=${signal ?? 'unknown'}`); + reject(Error('FFmpeg处理转换失败')); + }); + }); + }; + let input: Buffer; + if (!_isWav) { + input = await convert(); + } else { + input = file; + const allowSampleRate = [8000, 12000, 16000, 24000, 32000, 44100, 48000]; + const { fmt } = getWavFileInfo(input); + // log(`wav文件信息`, fmt) + if (!allowSampleRate.includes(fmt.sampleRate)) { + input = await convert(); + } + } + const silk = await encode(input, sampleRate); + fs.writeFileSync(pttPath, silk.data); + logger.log(`语音文件${filePath}转换成功!`, pttPath, '时长:', silk.duration); + return { + converted: true, + path: pttPath, + duration: silk.duration / 1000, + }; + } else { + const silk = file; + let duration = 0; + try { + duration = getDuration(silk) / 1000; + } catch (e: any) { + logger.log('获取语音文件时长失败, 使用文件大小推测时长', filePath, e.stack); + duration = await guessDuration(filePath); + } + + return { + converted: false, + path: filePath, + duration, + }; + } + } catch (error: any) { + logger.logError('convert silk failed', error.stack); + return {}; } - } catch (error: any) { - logger.logError('convert silk failed', error.stack); - return {}; - } } diff --git a/src/common/utils/file.ts b/src/common/utils/file.ts index 262b8bd4..34a71d21 100644 --- a/src/common/utils/file.ts +++ b/src/common/utils/file.ts @@ -1,299 +1,301 @@ import fs from 'fs'; import fsPromise, { stat } from 'fs/promises'; -import crypto from 'crypto'; +import crypto, { randomUUID } from 'crypto'; import util from 'util'; import path from 'node:path'; import * as fileType from 'file-type'; -import { randomUUID } from 'crypto'; import { LogWrapper } from './log'; export function isGIF(path: string) { - const buffer = Buffer.alloc(4); - const fd = fs.openSync(path, 'r'); - fs.readSync(fd, buffer, 0, 4, 0); - fs.closeSync(fd); - return buffer.toString() === 'GIF8'; + const buffer = Buffer.alloc(4); + const fd = fs.openSync(path, 'r'); + fs.readSync(fd, buffer, 0, 4, 0); + fs.closeSync(fd); + return buffer.toString() === 'GIF8'; } // 定义一个异步函数来检查文件是否存在 export function checkFileReceived(path: string, timeout: number = 3000): Promise { - return new Promise((resolve, reject) => { - const startTime = Date.now(); + return new Promise((resolve, reject) => { + const startTime = Date.now(); - function check() { - if (fs.existsSync(path)) { - resolve(); - } else if (Date.now() - startTime > timeout) { - reject(new Error(`文件不存在: ${path}`)); - } else { - setTimeout(check, 100); - } - } + function check() { + if (fs.existsSync(path)) { + resolve(); + } else if (Date.now() - startTime > timeout) { + reject(new Error(`文件不存在: ${path}`)); + } else { + setTimeout(check, 100); + } + } - check(); - }); + check(); + }); } + // 定义一个异步函数来检查文件是否存在 export async function checkFileReceived2(path: string, timeout: number = 3000): Promise { - // 使用 Promise.race 来同时进行文件状态检查和超时计时 - // Promise.race 会返回第一个解决(resolve)或拒绝(reject)的 Promise - await Promise.race([ - checkFile(path), - timeoutPromise(timeout, `文件不存在: ${path}`), - ]); + // 使用 Promise.race 来同时进行文件状态检查和超时计时 + // Promise.race 会返回第一个解决(resolve)或拒绝(reject)的 Promise + await Promise.race([ + checkFile(path), + timeoutPromise(timeout, `文件不存在: ${path}`), + ]); } // 转换超时时间至 Promise function timeoutPromise(timeout: number, errorMsg: string): Promise { - return new Promise((_, reject) => { - setTimeout(() => { - reject(new Error(errorMsg)); - }, timeout); - }); + return new Promise((_, reject) => { + setTimeout(() => { + reject(new Error(errorMsg)); + }, timeout); + }); } // 异步检查文件是否存在 async function checkFile(path: string): Promise { - try { - await stat(path); - } catch (error: any) { - if (error.code === 'ENOENT') { - // 如果文件不存在,则抛出一个错误 - throw new Error(`文件不存在: ${path}`); - } else { - // 对于 stat 调用的其他错误,重新抛出 - throw error; - } - } - // 如果文件存在,则无需做任何事情,Promise 解决(resolve)自身 -} -export async function file2base64(path: string) { - const readFile = util.promisify(fs.readFile); - const result = { - err: '', - data: '' - }; - try { - // 读取文件内容 - // if (!fs.existsSync(path)){ - // path = path.replace("\\Ori\\", "\\Thumb\\"); - // } try { - await checkFileReceived(path, 5000); - } catch (e: any) { - result.err = e.toString(); - return result; + await stat(path); + } catch (error: any) { + if (error.code === 'ENOENT') { + // 如果文件不存在,则抛出一个错误 + throw new Error(`文件不存在: ${path}`); + } else { + // 对于 stat 调用的其他错误,重新抛出 + throw error; + } } - const data = await readFile(path); - // 转换为Base64编码 - result.data = data.toString('base64'); - } catch (err: any) { - result.err = err.toString(); - } - return result; + // 如果文件存在,则无需做任何事情,Promise 解决(resolve)自身 +} + +export async function file2base64(path: string) { + const readFile = util.promisify(fs.readFile); + const result = { + err: '', + data: '', + }; + try { + // 读取文件内容 + // if (!fs.existsSync(path)){ + // path = path.replace("\\Ori\\", "\\Thumb\\"); + // } + try { + await checkFileReceived(path, 5000); + } catch (e: any) { + result.err = e.toString(); + return result; + } + const data = await readFile(path); + // 转换为Base64编码 + result.data = data.toString('base64'); + } catch (err: any) { + result.err = err.toString(); + } + return result; } export function calculateFileMD5(filePath: string): Promise { - return new Promise((resolve, reject) => { - // 创建一个流式读取器 - const stream = fs.createReadStream(filePath); - const hash = crypto.createHash('md5'); + return new Promise((resolve, reject) => { + // 创建一个流式读取器 + const stream = fs.createReadStream(filePath); + const hash = crypto.createHash('md5'); - stream.on('data', (data: Buffer) => { - // 当读取到数据时,更新哈希对象的状态 - hash.update(data); - }); + stream.on('data', (data: Buffer) => { + // 当读取到数据时,更新哈希对象的状态 + hash.update(data); + }); - stream.on('end', () => { - // 文件读取完成,计算哈希 - const md5 = hash.digest('hex'); - resolve(md5); - }); + stream.on('end', () => { + // 文件读取完成,计算哈希 + const md5 = hash.digest('hex'); + resolve(md5); + }); - stream.on('error', (err: Error) => { - // 处理可能的读取错误 - reject(err); + stream.on('error', (err: Error) => { + // 处理可能的读取错误 + reject(err); + }); }); - }); } export interface HttpDownloadOptions { - url: string; - headers?: Record | string; + url: string; + headers?: Record | string; } export async function httpDownload(options: string | HttpDownloadOptions): Promise { - const chunks: Buffer[] = []; - let url: string; - let headers: Record = { - 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36' - }; - if (typeof options === 'string') { - url = options; - const host = new URL(url).hostname; - headers['Host'] = host; - } else { - url = options.url; - if (options.headers) { - if (typeof options.headers === 'string') { - headers = JSON.parse(options.headers); - } else { - headers = options.headers; - } + const chunks: Buffer[] = []; + let url: string; + let headers: Record = { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36', + }; + if (typeof options === 'string') { + url = options; + const host = new URL(url).hostname; + headers['Host'] = host; + } else { + url = options.url; + if (options.headers) { + if (typeof options.headers === 'string') { + headers = JSON.parse(options.headers); + } else { + headers = options.headers; + } + } } - } - const fetchRes = await fetch(url, { headers }).catch((err) => { - if (err.cause) { - throw err.cause; - } - throw err; - }); - if (!fetchRes.ok) throw new Error(`下载文件失败: ${fetchRes.statusText}`); + const fetchRes = await fetch(url, { headers }).catch((err) => { + if (err.cause) { + throw err.cause; + } + throw err; + }); + if (!fetchRes.ok) throw new Error(`下载文件失败: ${fetchRes.statusText}`); - const blob = await fetchRes.blob(); - const buffer = await blob.arrayBuffer(); - return Buffer.from(buffer); + const blob = await fetchRes.blob(); + const buffer = await blob.arrayBuffer(); + return Buffer.from(buffer); } type Uri2LocalRes = { - success: boolean, - errMsg: string, - fileName: string, - ext: string, - path: string, - isLocal: boolean + success: boolean, + errMsg: string, + fileName: string, + ext: string, + path: string, + isLocal: boolean } export async function uri2local(TempDir: string, UriOrPath: string, fileName: string | null = null): Promise { - const res = { - success: false, - errMsg: '', - fileName: '', - ext: '', - path: '', - isLocal: false - }; - if (!fileName) fileName = randomUUID(); - let filePath = path.join(TempDir, fileName);//临时目录 - let url = null; - //区分path和uri - try { - if (fs.existsSync(UriOrPath)) url = new URL('file://' + UriOrPath); - } catch (error: any) { } - try { - url = new URL(UriOrPath); - } catch (error: any) { } - - //验证url - if (!url) { - res.errMsg = `UriOrPath ${UriOrPath} 解析失败,可能${UriOrPath}不存在`; - return res; - } - - if (url.protocol == 'base64:') { - // base64转成文件 - const base64Data = UriOrPath.split('base64://')[1]; + const res = { + success: false, + errMsg: '', + fileName: '', + ext: '', + path: '', + isLocal: false, + }; + if (!fileName) fileName = randomUUID(); + let filePath = path.join(TempDir, fileName);//临时目录 + let url = null; + //区分path和uri try { - const buffer = Buffer.from(base64Data, 'base64'); - fs.writeFileSync(filePath, buffer); - } catch (e: any) { - res.errMsg = 'base64文件下载失败,' + e.toString(); - return res; - } - } else if (url.protocol == 'http:' || url.protocol == 'https:') { - // 下载文件 - let buffer: Buffer | null = null; - try { - buffer = await httpDownload(UriOrPath); - } catch (e: any) { - res.errMsg = `${url}下载失败,` + e.toString(); - return res; + if (fs.existsSync(UriOrPath)) url = new URL('file://' + UriOrPath); + } catch (error: any) { } try { - const pathInfo = path.parse(decodeURIComponent(url.pathname)); - if (pathInfo.name) { - fileName = pathInfo.name; - if (pathInfo.ext) { - fileName += pathInfo.ext; - // res.ext = pathInfo.ext + url = new URL(UriOrPath); + } catch (error: any) { + } + + //验证url + if (!url) { + res.errMsg = `UriOrPath ${UriOrPath} 解析失败,可能${UriOrPath}不存在`; + return res; + } + + if (url.protocol == 'base64:') { + // base64转成文件 + const base64Data = UriOrPath.split('base64://')[1]; + try { + const buffer = Buffer.from(base64Data, 'base64'); + fs.writeFileSync(filePath, buffer); + } catch (e: any) { + res.errMsg = 'base64文件下载失败,' + e.toString(); + return res; } - } - fileName = fileName.replace(/[/\\:*?"<>|]/g, '_'); - res.fileName = fileName; - filePath = path.join(TempDir, randomUUID() + fileName); - fs.writeFileSync(filePath, buffer); - } catch (e: any) { - res.errMsg = `${url}下载失败,` + e.toString(); - return res; + } else if (url.protocol == 'http:' || url.protocol == 'https:') { + // 下载文件 + let buffer: Buffer | null = null; + try { + buffer = await httpDownload(UriOrPath); + } catch (e: any) { + res.errMsg = `${url}下载失败,` + e.toString(); + return res; + } + try { + const pathInfo = path.parse(decodeURIComponent(url.pathname)); + if (pathInfo.name) { + fileName = pathInfo.name; + if (pathInfo.ext) { + fileName += pathInfo.ext; + // res.ext = pathInfo.ext + } + } + fileName = fileName.replace(/[/\\:*?"<>|]/g, '_'); + res.fileName = fileName; + filePath = path.join(TempDir, randomUUID() + fileName); + fs.writeFileSync(filePath, buffer); + } catch (e: any) { + res.errMsg = `${url}下载失败,` + e.toString(); + return res; + } + } else { + let pathname: string; + if (url.protocol === 'file:') { + // await fs.copyFile(url.pathname, filePath); + pathname = decodeURIComponent(url.pathname); + if (process.platform === 'win32') { + filePath = pathname.slice(1); + } else { + filePath = pathname; + } + } else { + // 26702执行forword file文件操作 不应该在这里乱来 + // const cache = await dbUtil.getFileCacheByName(uri); + // if (cache) { + // filePath = cache.path; + // } else { + // filePath = uri; + // } + } + res.isLocal = true; } - } else { - let pathname: string; - if (url.protocol === 'file:') { - // await fs.copyFile(url.pathname, filePath); - pathname = decodeURIComponent(url.pathname); - if (process.platform === 'win32') { - filePath = pathname.slice(1); - } else { - filePath = pathname; - } + // else{ + // res.errMsg = `不支持的file协议,` + url.protocol + // return res + // } + // if (isGIF(filePath) && !res.isLocal) { + // await fs.rename(filePath, filePath + ".gif"); + // filePath += ".gif"; + // } + if (!res.isLocal && !res.ext) { + try { + const ext: string | undefined = (await fileType.fileTypeFromFile(filePath))?.ext; + if (ext) { + fs.renameSync(filePath, filePath + `.${ext}`); + filePath += `.${ext}`; + res.fileName += `.${ext}`; + res.ext = ext; + } + } catch (e) { + // log("获取文件类型失败", filePath,e.stack) + } } - else { - // 26702执行forword file文件操作 不应该在这里乱来 - // const cache = await dbUtil.getFileCacheByName(uri); - // if (cache) { - // filePath = cache.path; - // } else { - // filePath = uri; - // } - } - res.isLocal = true; - } - // else{ - // res.errMsg = `不支持的file协议,` + url.protocol - // return res - // } - // if (isGIF(filePath) && !res.isLocal) { - // await fs.rename(filePath, filePath + ".gif"); - // filePath += ".gif"; - // } - if (!res.isLocal && !res.ext) { - try { - const ext: string | undefined = (await fileType.fileTypeFromFile(filePath))?.ext; - if (ext) { - fs.renameSync(filePath, filePath + `.${ext}`); - filePath += `.${ext}`; - res.fileName += `.${ext}`; - res.ext = ext; - } - } catch (e) { - // log("获取文件类型失败", filePath,e.stack) - } - } - res.success = true; - res.path = filePath; - return res; + res.success = true; + res.path = filePath; + return res; } export async function copyFolder(sourcePath: string, destPath: string, logger: LogWrapper) { - try { - const entries = await fsPromise.readdir(sourcePath, { withFileTypes: true }); - await fsPromise.mkdir(destPath, { recursive: true }); - for (const entry of entries) { - const srcPath = path.join(sourcePath, entry.name); - const dstPath = path.join(destPath, entry.name); - if (entry.isDirectory()) { - await copyFolder(srcPath, dstPath, logger); - } else { - try { - await fsPromise.copyFile(srcPath, dstPath); - } catch (error) { - logger.logError(`无法复制文件 '${srcPath}' 到 '${dstPath}': ${error}`); - // 这里可以决定是否要继续复制其他文件 + try { + const entries = await fsPromise.readdir(sourcePath, { withFileTypes: true }); + await fsPromise.mkdir(destPath, { recursive: true }); + for (const entry of entries) { + const srcPath = path.join(sourcePath, entry.name); + const dstPath = path.join(destPath, entry.name); + if (entry.isDirectory()) { + await copyFolder(srcPath, dstPath, logger); + } else { + try { + await fsPromise.copyFile(srcPath, dstPath); + } catch (error) { + logger.logError(`无法复制文件 '${srcPath}' 到 '${dstPath}': ${error}`); + // 这里可以决定是否要继续复制其他文件 + } + } } - } + } catch (error) { + logger.logError('复制文件夹时出错:', error); } - } catch (error) { - logger.logError('复制文件夹时出错:', error); - } } diff --git a/src/common/utils/helper.ts b/src/common/utils/helper.ts index fe73721a..bf0f8704 100644 --- a/src/common/utils/helper.ts +++ b/src/common/utils/helper.ts @@ -1,9 +1,9 @@ -import crypto from "node:crypto"; -import path from "node:path"; -import fs from "fs"; -import * as fsPromise from "node:fs/promises"; -import os from "node:os"; -import { QQLevel } from "@/core"; +import crypto from 'node:crypto'; +import path from 'node:path'; +import fs from 'fs'; +import * as fsPromise from 'node:fs/promises'; +import os from 'node:os'; +import { QQLevel } from '@/core'; //下面这个类是用于将uid+msgid合并的类 @@ -11,19 +11,20 @@ export class UUIDConverter { static encode(highStr: string, lowStr: string): string { const high = BigInt(highStr); const low = BigInt(lowStr); - const highHex = high.toString(16).padStart(16, "0"); - const lowHex = low.toString(16).padStart(16, "0"); + const highHex = high.toString(16).padStart(16, '0'); + const lowHex = low.toString(16).padStart(16, '0'); const combinedHex = highHex + lowHex; const uuid = `${combinedHex.substring(0, 8)}-${combinedHex.substring(8, 12)}-${combinedHex.substring( 12, - 16 + 16, )}-${combinedHex.substring(16, 20)}-${combinedHex.substring(20)}`; return uuid; } + static decode(uuid: string): { high: string; low: string } { - const hex = uuid.replace(/-/g, ""); - const high = BigInt("0x" + hex.substring(0, 16)); - const low = BigInt("0x" + hex.substring(16)); + const hex = uuid.replace(/-/g, ''); + const high = BigInt('0x' + hex.substring(0, 16)); + const low = BigInt('0x' + hex.substring(16)); return { high: high.toString(), low: low.toString() }; } } @@ -34,27 +35,28 @@ export function sleep(ms: number): Promise { export function PromiseTimer(promise: Promise, ms: number): Promise { const timeoutPromise = new Promise((_, reject) => - setTimeout(() => reject(new Error("PromiseTimer: Operation timed out")), ms) + setTimeout(() => reject(new Error('PromiseTimer: Operation timed out')), ms), ); return Promise.race([promise, timeoutPromise]); } + export async function runAllWithTimeout(tasks: Promise[], timeout: number): Promise { const wrappedTasks = tasks.map((task) => PromiseTimer(task, timeout).then( - (result) => ({ status: "fulfilled", value: result }), - (error) => ({ status: "rejected", reason: error }) - ) + (result) => ({ status: 'fulfilled', value: result }), + (error) => ({ status: 'rejected', reason: error }), + ), ); const results = await Promise.all(wrappedTasks); return results - .filter((result) => result.status === "fulfilled") - .map((result) => (result as { status: "fulfilled"; value: T }).value); + .filter((result) => result.status === 'fulfilled') + .map((result) => (result as { status: 'fulfilled'; value: T }).value); } export function getMd5(s: string) { - const h = crypto.createHash("md5"); + const h = crypto.createHash('md5'); h.update(s); - return h.digest("hex"); + return h.digest('hex'); } export function isNull(value: any) { @@ -64,15 +66,16 @@ export function isNull(value: any) { export function isNumeric(str: string) { return /^\d+$/.test(str); } + export function truncateString(obj: any, maxLength = 500) { - if (obj !== null && typeof obj === "object") { + if (obj !== null && typeof obj === 'object') { Object.keys(obj).forEach((key) => { - if (typeof obj[key] === "string") { + if (typeof obj[key] === 'string') { // 如果是字符串且超过指定长度,则截断 if (obj[key].length > maxLength) { - obj[key] = obj[key].substring(0, maxLength) + "..."; + obj[key] = obj[key].substring(0, maxLength) + '...'; } - } else if (typeof obj[key] === "object") { + } else if (typeof obj[key] === 'object') { // 如果是对象或数组,则递归调用 truncateString(obj[key], maxLength); } @@ -80,10 +83,11 @@ export function truncateString(obj: any, maxLength = 500) { } return obj; } + export function isEqual(obj1: any, obj2: any) { if (obj1 === obj2) return true; if (obj1 == null || obj2 == null) return false; - if (typeof obj1 !== "object" || typeof obj2 !== "object") return obj1 === obj2; + if (typeof obj1 !== 'object' || typeof obj2 !== 'object') return obj1 === obj2; const keys1 = Object.keys(obj1); const keys2 = Object.keys(obj2); @@ -95,35 +99,36 @@ export function isEqual(obj1: any, obj2: any) { } return true; } + export function getDefaultQQVersionConfigInfo(): QQVersionConfigType { - if (os.platform() === "linux") { + if (os.platform() === 'linux') { return { - baseVersion: "3.2.12-26702", - curVersion: "3.2.12-26702", - prevVersion: "", + baseVersion: '3.2.12-26702', + curVersion: '3.2.12-26702', + prevVersion: '', onErrorVersions: [], - buildId: "26702", + buildId: '26702', }; } return { - baseVersion: "9.9.15-26702", - curVersion: "9.9.15-26702", - prevVersion: "", + baseVersion: '9.9.15-26702', + curVersion: '9.9.15-26702', + prevVersion: '', onErrorVersions: [], - buildId: "26702", + buildId: '26702', }; } -export function getQQVersionConfigPath(exePath: string = ""): string | undefined { +export function getQQVersionConfigPath(exePath: string = ''): string | undefined { let configVersionInfoPath; - if (os.platform() !== "linux") { - configVersionInfoPath = path.join(path.dirname(exePath), "resources", "app", "versions", "config.json"); + if (os.platform() !== 'linux') { + configVersionInfoPath = path.join(path.dirname(exePath), 'resources', 'app', 'versions', 'config.json'); } else { const userPath = os.homedir(); - const appDataPath = path.resolve(userPath, "./.config/QQ"); - configVersionInfoPath = path.resolve(appDataPath, "./versions/config.json"); + const appDataPath = path.resolve(userPath, './.config/QQ'); + configVersionInfoPath = path.resolve(appDataPath, './versions/config.json'); } - if (typeof configVersionInfoPath !== "string") { + if (typeof configVersionInfoPath !== 'string') { return undefined; } if (!fs.existsSync(configVersionInfoPath)) { @@ -153,7 +158,8 @@ export async function deleteOldFiles(directoryPath: string, daysThreshold: numbe //console.error('Error deleting files:', error); } } + export function calcQQLevel(level: QQLevel) { - const { crownNum, sunNum, moonNum, starNum } = level; - return crownNum * 64 + sunNum * 16 + moonNum * 4 + starNum; + const { crownNum, sunNum, moonNum, starNum } = level; + return crownNum * 64 + sunNum * 16 + moonNum * 4 + starNum; } diff --git a/src/common/utils/log.ts b/src/common/utils/log.ts index f2b55e11..b90b0e3d 100644 --- a/src/common/utils/log.ts +++ b/src/common/utils/log.ts @@ -2,13 +2,15 @@ import log4js, { Configuration } from 'log4js'; import { truncateString } from '@/common/utils/helper'; import path from 'node:path'; import chalk from 'chalk'; + export enum LogLevel { - DEBUG = 'debug', - INFO = 'info', - WARN = 'warn', - ERROR = 'error', - FATAL = 'fatal', + DEBUG = 'debug', + INFO = 'info', + WARN = 'warn', + ERROR = 'error', + FATAL = 'fatal', } + function getFormattedTimestamp() { const now = new Date(); const year = now.getFullYear(); @@ -20,6 +22,7 @@ function getFormattedTimestamp() { const milliseconds = now.getMilliseconds().toString().padStart(3, '0'); return `${year}-${month}-${day}_${hours}-${minutes}-${seconds}.${milliseconds}`; } + export class LogWrapper { fileLogEnabled = true; consoleLogEnabled = true; @@ -29,8 +32,9 @@ export class LogWrapper { loggerDefault: log4js.Logger; // eslint-disable-next-line no-control-regex colorEscape = /\x1B[@-_][0-?]*[ -/]*[@-~]/g; + constructor(logDir: string) { - // logDir = path.join(path.resolve(__dirname), 'logs'); + // logDir = path.join(path.resolve(__dirname), 'logs'); const filename = `${getFormattedTimestamp()}.log`; const logPath = path.join(logDir, filename); this.logConfig = { @@ -41,22 +45,22 @@ export class LogWrapper { maxLogSize: 10485760, // 日志文件的最大大小(单位:字节),这里设置为10MB layout: { type: 'pattern', - pattern: '%d{yyyy-MM-dd hh:mm:ss} [%p] %X{userInfo} | %m' - } + pattern: '%d{yyyy-MM-dd hh:mm:ss} [%p] %X{userInfo} | %m', + }, }, ConsoleAppender: { // 输出到控制台的appender type: 'console', layout: { type: 'pattern', - pattern: `%d{yyyy-MM-dd hh:mm:ss} [%[%p%]] ${chalk.magenta('%X{userInfo}')} | %m` - } - } + pattern: `%d{yyyy-MM-dd hh:mm:ss} [%[%p%]] ${chalk.magenta('%X{userInfo}')} | %m`, + }, + }, }, categories: { default: { appenders: ['FileAppender', 'ConsoleAppender'], level: 'debug' }, // 默认情况下同时输出到文件和控制台 file: { appenders: ['FileAppender'], level: 'debug' }, - console: { appenders: ['ConsoleAppender'], level: 'debug' } - } + console: { appenders: ['ConsoleAppender'], level: 'debug' }, + }, }; log4js.configure(this.logConfig); this.loggerConsole = log4js.getLogger('console'); @@ -64,6 +68,7 @@ export class LogWrapper { this.loggerDefault = log4js.getLogger('default'); this.setLogSelfInfo({ nick: '', uin: '', uid: '' }); } + setLogLevel(fileLogLevel: LogLevel, consoleLogLevel: LogLevel) { this.logConfig.categories.file.level = fileLogLevel; this.logConfig.categories.console.level = consoleLogLevel; @@ -81,6 +86,7 @@ export class LogWrapper { enableFileLog(enable: boolean) { this.fileLogEnabled = enable; } + enableConsoleLog(enable: boolean) { this.consoleLogEnabled = enable; } @@ -102,7 +108,6 @@ export class LogWrapper { } - _log(level: LogLevel, ...args: any[]) { if (this.consoleLogEnabled) { this.loggerConsole[level](this.formatMsg(args)); @@ -113,7 +118,7 @@ export class LogWrapper { } log(...args: any[]) { - // info 等级 + // info 等级 this._log(LogLevel.INFO, ...args); } diff --git a/src/common/utils/proxy-handler.ts b/src/common/utils/proxy-handler.ts index 98f5e08a..7b8dba82 100644 --- a/src/common/utils/proxy-handler.ts +++ b/src/common/utils/proxy-handler.ts @@ -1,4 +1,4 @@ -import { LogWrapper } from "./log"; +import { LogWrapper } from './log'; export function proxyHandlerOf(logger: LogWrapper) { return { @@ -12,10 +12,10 @@ export function proxyHandlerOf(logger: LogWrapper) { } // 如果方法存在,正常返回 return Reflect.get(target, prop, receiver); - } + }, }; } export function proxiedListenerOf(listener: T, logger: LogWrapper) { return new Proxy(listener, proxyHandlerOf(logger)); -} \ No newline at end of file +} diff --git a/src/common/utils/request.ts b/src/common/utils/request.ts index 0ca401b6..22741a28 100644 --- a/src/common/utils/request.ts +++ b/src/common/utils/request.ts @@ -1,6 +1,7 @@ import https from 'node:https'; import http from 'node:http'; import { readFileSync } from 'node:fs'; + export class RequestUtil { // 适用于获取服务器下发cookies时获取,仅GET static async HttpsGetCookies(url: string): Promise<{ [key: string]: string }> { @@ -27,7 +28,8 @@ export class RequestUtil { resolve(cookies); } }; - res.on('data', () => { }); // Necessary to consume the stream + res.on('data', () => { + }); // Necessary to consume the stream res.on('end', () => { handleRedirect(res); }); @@ -45,14 +47,15 @@ export class RequestUtil { }); req.on('error', (error: any) => { reject(error); - }); + }); }); } - // 请求和回复都是JSON data传原始内容 自动编码json - static async HttpGetJson(url: string, method: string = 'GET', data?: any, headers: { [key: string]: string } = {}, isJsonRet: boolean = true, isArgJson: boolean = true): Promise { + static async HttpGetJson(url: string, method: string = 'GET', data?: any, headers: { + [key: string]: string + } = {}, isJsonRet: boolean = true, isArgJson: boolean = true): Promise { const option = new URL(url); const protocol = url.startsWith('https://') ? https : http; const options = { @@ -60,7 +63,7 @@ export class RequestUtil { port: option.port, path: option.href, method: method, - headers: headers + headers: headers, }; // headers: { // 'Content-Type': 'application/json', @@ -119,7 +122,7 @@ export class RequestUtil { const formDataParts = [ `------${boundary}\r\n`, `Content-Disposition: form-data; name="share_image"; filename="${filePath}"\r\n`, - 'Content-Type: ' + type + '\r\n\r\n' + 'Content-Type: ' + type + '\r\n\r\n', ]; const fileContent = readFileSync(filePath); @@ -127,65 +130,65 @@ export class RequestUtil { return Buffer.concat([ Buffer.from(formDataParts.join(''), 'utf8'), fileContent, - Buffer.from(footer, 'utf8') + Buffer.from(footer, 'utf8'), ]); } - static async uploadImageForOpenPlatform(filePath: string,cookies:string): Promise { + static async uploadImageForOpenPlatform(filePath: string, cookies: string): Promise { return new Promise(async (resolve, reject) => { - type retType = { retcode: number, result?: { url: string } }; - try { - const options = { - hostname: 'cgi.connect.qq.com', - port: 443, - path: '/qqconnectopen/upload_share_image', - method: 'POST', - headers: { - 'Referer': 'https://cgi.connect.qq.com', - 'Cookie': cookies, - 'Accept': '*/*', - 'Connection': 'keep-alive', - 'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' - } - }; - const req = https.request(options, async (res) => { - let responseBody = ''; + type retType = { retcode: number, result?: { url: string } }; + try { + const options = { + hostname: 'cgi.connect.qq.com', + port: 443, + path: '/qqconnectopen/upload_share_image', + method: 'POST', + headers: { + 'Referer': 'https://cgi.connect.qq.com', + 'Cookie': cookies, + 'Accept': '*/*', + 'Connection': 'keep-alive', + 'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW', + }, + }; + const req = https.request(options, async (res) => { + let responseBody = ''; - res.on('data', (chunk: string | Buffer) => { - responseBody += chunk.toString(); - }); + res.on('data', (chunk: string | Buffer) => { + responseBody += chunk.toString(); + }); - res.on('end', () => { - try { - if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) { - const responseJson = JSON.parse(responseBody) as retType; - resolve(responseJson.result!.url!); - } else { - reject(new Error(`Unexpected status code: ${res.statusCode}`)); - } - } catch (parseError) { - reject(parseError); - } + res.on('end', () => { + try { + if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) { + const responseJson = JSON.parse(responseBody) as retType; + resolve(responseJson.result!.url!); + } else { + reject(new Error(`Unexpected status code: ${res.statusCode}`)); + } + } catch (parseError) { + reject(parseError); + } - }); + }); - }); + }); - req.on('error', (error) => { - reject(error); - console.error('Error during upload:', error); - }); + req.on('error', (error) => { + reject(error); + console.error('Error during upload:', error); + }); - const body = await RequestUtil.createFormData('WebKitFormBoundary7MA4YWxkTrZu0gW', filePath); - // req.setHeader('Content-Length', Buffer.byteLength(body)); - // console.log(`Prepared data size: ${Buffer.byteLength(body)} bytes`); - req.write(body); - req.end(); - return; - } catch (error) { - reject(error); - } - return undefined; + const body = await RequestUtil.createFormData('WebKitFormBoundary7MA4YWxkTrZu0gW', filePath); + // req.setHeader('Content-Length', Buffer.byteLength(body)); + // console.log(`Prepared data size: ${Buffer.byteLength(body)} bytes`); + req.write(body); + req.end(); + return; + } catch (error) { + reject(error); + } + return undefined; }); } } diff --git a/src/common/utils/system.ts b/src/common/utils/system.ts index 91520d4a..5411bbb6 100644 --- a/src/common/utils/system.ts +++ b/src/common/utils/system.ts @@ -17,7 +17,7 @@ try { const invalidMacAddresses = new Set([ '00:00:00:00:00:00', 'ff:ff:ff:ff:ff:ff', - 'ac:de:48:00:11:22' + 'ac:de:48:00:11:22', ]); function validateMacAddress(candidate: string): boolean { @@ -70,4 +70,4 @@ export const cpuArch = os.arch(); export const systemVersion = os.release(); export const hostname = osName; export const downloadsPath = path.join(homeDir, 'Downloads'); -export const systemName = os.type(); \ No newline at end of file +export const systemName = os.type(); diff --git a/src/common/utils/types.ts b/src/common/utils/types.ts index 7e62606c..91fa060d 100644 --- a/src/common/utils/types.ts +++ b/src/common/utils/types.ts @@ -1,17 +1,17 @@ //QQVersionType type QQPackageInfoType = { - version: string; - buildVersion: string; - platform: string; - eleArch: string; + version: string; + buildVersion: string; + platform: string; + eleArch: string; } type QQVersionConfigType = { - baseVersion: string; - curVersion: string; - prevVersion: string; - onErrorVersions: Array; - buildId: string; + baseVersion: string; + curVersion: string; + prevVersion: string; + onErrorVersions: Array; + buildId: string; } type QQAppidTableType = { - [key: string]: { appid: string, qua: string }; -} \ No newline at end of file + [key: string]: { appid: string, qua: string }; +} diff --git a/src/common/utils/video.ts b/src/common/utils/video.ts index ba6a3db3..ecc57e88 100644 --- a/src/common/utils/video.ts +++ b/src/common/utils/video.ts @@ -2,57 +2,58 @@ import ffmpeg, { FfprobeStream } from 'fluent-ffmpeg'; import fs from 'fs'; import type { LogWrapper } from './log'; -export async function getVideoInfo(filePath: string,logger:LogWrapper) { - const size = fs.statSync(filePath).size; - return new Promise<{ - width: number, - height: number, - time: number, - format: string, - size: number, - filePath: string - }>((resolve, reject) => { - const ffmpegPath = process.env.FFMPEG_PATH; - ffmpegPath && ffmpeg.setFfmpegPath(ffmpegPath); - ffmpeg(filePath).ffprobe((err: any, metadata: ffmpeg.FfprobeData) => { - if (err) { - reject(err); - } else { - const videoStream = metadata.streams.find((s: FfprobeStream) => s.codec_type === 'video'); - if (videoStream) { - logger.log(`视频尺寸: ${videoStream.width}x${videoStream.height}`); - } else { - return reject('未找到视频流信息。'); - } - resolve({ - width: videoStream.width!, height: videoStream.height!, - time: parseInt(videoStream.duration!), - format: metadata.format.format_name!, - size, - filePath +export async function getVideoInfo(filePath: string, logger: LogWrapper) { + const size = fs.statSync(filePath).size; + return new Promise<{ + width: number, + height: number, + time: number, + format: string, + size: number, + filePath: string + }>((resolve, reject) => { + const ffmpegPath = process.env.FFMPEG_PATH; + ffmpegPath && ffmpeg.setFfmpegPath(ffmpegPath); + ffmpeg(filePath).ffprobe((err: any, metadata: ffmpeg.FfprobeData) => { + if (err) { + reject(err); + } else { + const videoStream = metadata.streams.find((s: FfprobeStream) => s.codec_type === 'video'); + if (videoStream) { + logger.log(`视频尺寸: ${videoStream.width}x${videoStream.height}`); + } else { + return reject('未找到视频流信息。'); + } + resolve({ + width: videoStream.width!, height: videoStream.height!, + time: parseInt(videoStream.duration!), + format: metadata.format.format_name!, + size, + filePath, + }); + } }); - } }); - }); } -export function checkFfmpeg(newPath: string | null = null,logger:LogWrapper): Promise { - return new Promise((resolve, reject) => { - logger.log('开始检查ffmpeg', newPath); - if (newPath) { - ffmpeg.setFfmpegPath(newPath); - } - try { - ffmpeg.getAvailableFormats((err: any, formats: any) => { - if (err) { - logger.log('ffmpeg is not installed or not found in PATH:', err); - resolve(false); - } else { - logger.log('ffmpeg is installed.'); - resolve(true); + +export function checkFfmpeg(newPath: string | null = null, logger: LogWrapper): Promise { + return new Promise((resolve, reject) => { + logger.log('开始检查ffmpeg', newPath); + if (newPath) { + ffmpeg.setFfmpegPath(newPath); } - }); - } catch (e) { - resolve(false); - } - }); + try { + ffmpeg.getAvailableFormats((err: any, formats: any) => { + if (err) { + logger.log('ffmpeg is not installed or not found in PATH:', err); + resolve(false); + } else { + logger.log('ffmpeg is installed.'); + resolve(true); + } + }); + } catch (e) { + resolve(false); + } + }); } diff --git a/src/core/adapters/NodeIDependsAdapter.ts b/src/core/adapters/NodeIDependsAdapter.ts index a11687fa..05c5b13e 100644 --- a/src/core/adapters/NodeIDependsAdapter.ts +++ b/src/core/adapters/NodeIDependsAdapter.ts @@ -1,24 +1,22 @@ -import { log } from "@/common/utils/log"; - interface IDependsAdapter { - onMSFStatusChange(arg1: number, arg2: number): void; + onMSFStatusChange(arg1: number, arg2: number): void; - onMSFSsoError(args: unknown): void; + onMSFSsoError(args: unknown): void; - getGroupCode(args: unknown): void; + getGroupCode(args: unknown): void; } export interface NodeIDependsAdapter extends IDependsAdapter { - // eslint-disable-next-line @typescript-eslint/no-misused-new - new(adapter: IDependsAdapter): NodeIDependsAdapter; + // eslint-disable-next-line @typescript-eslint/no-misused-new + new(adapter: IDependsAdapter): NodeIDependsAdapter; } export class DependsAdapter implements IDependsAdapter { onMSFStatusChange(arg1: number, arg2: number) { - // console.log(arg1, arg2); - // if (arg1 == 2 && arg2 == 2) { - // log("NapCat丢失网络连接,请检查网络") - // } + // console.log(arg1, arg2); + // if (arg1 == 2 && arg2 == 2) { + // log("NapCat丢失网络连接,请检查网络") + // } } onMSFSsoError(args: unknown) { diff --git a/src/core/adapters/NodeIDispatcherAdapter.ts b/src/core/adapters/NodeIDispatcherAdapter.ts index 0bb2844a..b5c4565a 100644 --- a/src/core/adapters/NodeIDispatcherAdapter.ts +++ b/src/core/adapters/NodeIDispatcherAdapter.ts @@ -1,14 +1,14 @@ interface IDispatcherAdapter { - dispatchRequest(arg: unknown): void; + dispatchRequest(arg: unknown): void; - dispatchCall(arg: unknown): void; + dispatchCall(arg: unknown): void; - dispatchCallWithJson(arg: unknown): void; + dispatchCallWithJson(arg: unknown): void; } export interface NodeIDispatcherAdapter extends IDispatcherAdapter { - // eslint-disable-next-line @typescript-eslint/no-misused-new - new(adapter: IDispatcherAdapter): NodeIDispatcherAdapter; + // eslint-disable-next-line @typescript-eslint/no-misused-new + new(adapter: IDispatcherAdapter): NodeIDispatcherAdapter; } export class DispatcherAdapter implements IDispatcherAdapter { diff --git a/src/core/adapters/NodeIGlobalAdapter.ts b/src/core/adapters/NodeIGlobalAdapter.ts index 15c910a0..5103faf9 100644 --- a/src/core/adapters/NodeIGlobalAdapter.ts +++ b/src/core/adapters/NodeIGlobalAdapter.ts @@ -1,24 +1,24 @@ interface IGlobalAdapter { - onLog(...args: unknown[]): void; + onLog(...args: unknown[]): void; - onGetSrvCalTime(...args: unknown[]): void; + onGetSrvCalTime(...args: unknown[]): void; - onShowErrUITips(...args: unknown[]): void; + onShowErrUITips(...args: unknown[]): void; - fixPicImgType(...args: unknown[]): void; + fixPicImgType(...args: unknown[]): void; - getAppSetting(...args: unknown[]): void; + getAppSetting(...args: unknown[]): void; - onInstallFinished(...args: unknown[]): void; + onInstallFinished(...args: unknown[]): void; - onUpdateGeneralFlag(...args: unknown[]): void; + onUpdateGeneralFlag(...args: unknown[]): void; - onGetOfflineMsg(...args: unknown[]): void; + onGetOfflineMsg(...args: unknown[]): void; } export interface NodeIGlobalAdapter extends IGlobalAdapter { - // eslint-disable-next-line @typescript-eslint/no-misused-new - new(adapter: IGlobalAdapter): NodeIGlobalAdapter; + // eslint-disable-next-line @typescript-eslint/no-misused-new + new(adapter: IGlobalAdapter): NodeIGlobalAdapter; } export class GlobalAdapter implements IGlobalAdapter { diff --git a/src/core/apis/collection.ts b/src/core/apis/collection.ts index 91a95b55..a83ad38b 100644 --- a/src/core/apis/collection.ts +++ b/src/core/apis/collection.ts @@ -1,12 +1,14 @@ -import { InstanceContext, NapCatCore } from ".."; +import { InstanceContext, NapCatCore } from '..'; export class NTQQCollectionApi { context: InstanceContext; core: NapCatCore; + constructor(context: InstanceContext, core: NapCatCore) { this.context = context; this.core = core; } + async createCollection(authorUin: string, authorUid: string, authorName: string, brief: string, rawData: string) { const param = { commInfo: { @@ -18,11 +20,11 @@ export class NTQQCollectionApi { strId: authorName, groupId: '0', groupName: '', - uid: authorUid + uid: authorUid, }, customGroupId: '0', createTime: Date.now().toString(), - sequence: Date.now().toString() + sequence: Date.now().toString(), }, richMediaSummary: { originalUri: '', @@ -32,27 +34,28 @@ export class NTQQCollectionApi { title: '', brief: brief, picList: [], - contentType: 1 + contentType: 1, }, richMediaContent: { rawData: rawData, bizDataList: [], picList: [], - fileList: [] + fileList: [], }, - need_share_url: false + need_share_url: false, }; return this.context.session.getCollectionService().createNewCollectionItem(param); } + async getAllCollection(category: number = 0, count: number = 50) { const param = { category: category, groupId: -1, forceSync: true, forceFromDb: false, - timeStamp: "0", + timeStamp: '0', count: count, - searchDown: true + searchDown: true, }; return this.context.session.getCollectionService().getCollectionItemList(param); } diff --git a/src/core/apis/file.ts b/src/core/apis/file.ts index 2154af95..9b463250 100644 --- a/src/core/apis/file.ts +++ b/src/core/apis/file.ts @@ -3,7 +3,11 @@ import { CacheFileType, ChatCacheListItemBasic, ChatType, - ElementType, IMAGE_HTTP_HOST, IMAGE_HTTP_HOST_NT, Peer, PicElement + ElementType, + IMAGE_HTTP_HOST, + IMAGE_HTTP_HOST_NT, + Peer, + PicElement, } from '@/core/entities'; import path from 'path'; import fs from 'fs'; @@ -21,11 +25,13 @@ export class NTQQFileApi { context: InstanceContext; core: NapCatCore; rkeyManager: RkeyManager; + constructor(context: InstanceContext, core: NapCatCore) { this.context = context; this.core = core; this.rkeyManager = new RkeyManager('http://napcat-sign.wumiao.wang:2082/rkey', this.context.logger); } + async getFileType(filePath: string) { return fileType.fileTypeFromFile(filePath); } @@ -37,12 +43,17 @@ export class NTQQFileApi { async getFileSize(filePath: string): Promise { return await this.context.wrapper.util.getFileSize(filePath); } + async getVideoUrl(peer: Peer, msgId: string, elementId: string) { - return (await this.context.session.getRichMediaService().getVideoPlayUrlV2(peer, msgId, elementId, 0, { downSourceType: 1, triggerType: 1 })).urlResult.domainUrl; + return (await this.context.session.getRichMediaService().getVideoPlayUrlV2(peer, msgId, elementId, 0, { + downSourceType: 1, + triggerType: 1, + })).urlResult.domainUrl; } + // 上传文件到QQ的文件夹 async uploadFile(filePath: string, elementType: ElementType = ElementType.PIC, elementSubType: number = 0) { - // napCatCore.wrapper.util. + // napCatCore.wrapper.util. const fileMd5 = await calculateFileMD5(filePath); let ext: string = (await this.getFileType(filePath))?.ext as string || ''; if (ext) { @@ -60,7 +71,7 @@ export class NTQQFileApi { thumbSize: 0, needCreate: true, downloadType: 1, - file_uuid: '' + file_uuid: '', }); await this.copyFile(filePath, mediaPath!); const fileSize = await this.getFileSize(filePath); @@ -69,76 +80,78 @@ export class NTQQFileApi { fileName, path: mediaPath, fileSize, - ext + ext, }; } + async downloadMediaByUuid() { - //napCatCore.session.getRichMediaService().downloadFileForFileUuid(); + //napCatCore.session.getRichMediaService().downloadFileForFileUuid(); } + async downloadMedia(msgId: string, chatType: ChatType, peerUid: string, elementId: string, thumbPath: string, sourcePath: string, timeout = 1000 * 60 * 2, force: boolean = false) { - //logDebug('receive downloadMedia task', msgId, chatType, peerUid, elementId, thumbPath, sourcePath, timeout, force); - // 用于下载收到的消息中的图片等 - if (sourcePath && fs.existsSync(sourcePath)) { - if (force) { - try { - await fsPromises.unlink(sourcePath); - } catch (e) { - // - } - } else { - return sourcePath; + //logDebug('receive downloadMedia task', msgId, chatType, peerUid, elementId, thumbPath, sourcePath, timeout, force); + // 用于下载收到的消息中的图片等 + if (sourcePath && fs.existsSync(sourcePath)) { + if (force) { + try { + await fsPromises.unlink(sourcePath); + } catch (e) { + // + } + } else { + return sourcePath; + } } - } - const data = await this.core.eventWrapper.CallNormalEvent< - ( - params: { - fileModelId: string, - downloadSourceType: number, - triggerType: number, - msgId: string, - chatType: ChatType, - peerUid: string, - elementId: string, - thumbSize: number, - downloadType: number, - filePath: string - }) => Promise, - (fileTransNotifyInfo: OnRichMediaDownloadCompleteParams) => void - >( - 'NodeIKernelMsgService/downloadRichMedia', - 'NodeIKernelMsgListener/onRichMediaDownloadComplete', - 1, - timeout, - (arg: OnRichMediaDownloadCompleteParams) => { - if (arg.msgId === msgId) { - return true; - } - return false; - }, - { - fileModelId: '0', - downloadSourceType: 0, - triggerType: 1, - msgId: msgId, - chatType: chatType, - peerUid: peerUid, - elementId: elementId, - thumbSize: 0, - downloadType: 1, - filePath: thumbPath + const data = await this.core.eventWrapper.CallNormalEvent< + ( + params: { + fileModelId: string, + downloadSourceType: number, + triggerType: number, + msgId: string, + chatType: ChatType, + peerUid: string, + elementId: string, + thumbSize: number, + downloadType: number, + filePath: string + }) => Promise, + (fileTransNotifyInfo: OnRichMediaDownloadCompleteParams) => void + >( + 'NodeIKernelMsgService/downloadRichMedia', + 'NodeIKernelMsgListener/onRichMediaDownloadComplete', + 1, + timeout, + (arg: OnRichMediaDownloadCompleteParams) => { + if (arg.msgId === msgId) { + return true; + } + return false; + }, + { + fileModelId: '0', + downloadSourceType: 0, + triggerType: 1, + msgId: msgId, + chatType: chatType, + peerUid: peerUid, + elementId: elementId, + thumbSize: 0, + downloadType: 1, + filePath: thumbPath, + }, + ); + let filePath = data[1].filePath; + if (filePath.startsWith('\\')) { + // log('filePath start with \\'); + // Mlikiowa V2.0.0 Refactor Todo + //const downloadPath = sessionConfig.defaultFileDownloadPath; + //logDebug('downloadPath', downloadPath); + //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + filePath = path.join('', filePath); + // 下载路径是下载文件夹的相对路径 } - ); - let filePath = data[1].filePath; - if (filePath.startsWith('\\')) { - // log('filePath start with \\'); - // Mlikiowa V2.0.0 Refactor Todo - //const downloadPath = sessionConfig.defaultFileDownloadPath; - //logDebug('downloadPath', downloadPath); - //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - filePath = path.join("", filePath); - // 下载路径是下载文件夹的相对路径 - } - return filePath; + return filePath; } async getImageSize(filePath: string): Promise { @@ -152,25 +165,26 @@ export class NTQQFileApi { }); }); } + async addFileCache(peer: Peer, msgId: string, msgSeq: string, senderUid: string, elemId: string, elemType: string, fileSize: string, fileName: string) { let GroupData; let BuddyData; if (peer.chatType === ChatType.group) { GroupData = - [{ - groupCode: peer.peerUid, - isConf: false, - hasModifyConfGroupFace: true, - hasModifyConfGroupName: true, - groupName: "NapCat.Cached", - remark: "NapCat.Cached" - }]; + [{ + groupCode: peer.peerUid, + isConf: false, + hasModifyConfGroupFace: true, + hasModifyConfGroupName: true, + groupName: 'NapCat.Cached', + remark: 'NapCat.Cached', + }]; } else if (peer.chatType === ChatType.friend) { BuddyData = [{ category_name: 'NapCat.Cached', peerUid: peer.peerUid, peerUin: peer.peerUid, - remark: 'NapCat.Cached' + remark: 'NapCat.Cached', }]; } else { return undefined; @@ -204,65 +218,68 @@ export class NTQQFileApi { fileName: fileName, hits: [{ start: 12, - end: 14 - }] - } - ] + end: 14, + }], + }, + ], }); } + async searchfile(keys: string[]) { - type EventType = NodeIKernelSearchService['searchFileWithKeywords']; - interface OnListener { - 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 - }[] - }[] - } - const Event = this.core.eventWrapper.createEventFunction('NodeIKernelSearchService/searchFileWithKeywords'); - let id = ''; - const Listener = this.core.eventWrapper.RegisterListen<(params: OnListener) => void> - ( - 'NodeIKernelSearchListener/onSearchFileKeywordsResult', - 1, - 20000, - (params) => id !== '' && params.searchId == id - ); - id = await Event!(keys, 12); - const [ret] = (await Listener); - return ret; + type EventType = NodeIKernelSearchService['searchFileWithKeywords']; + + interface OnListener { + 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 + }[] + }[] + } + + const Event = this.core.eventWrapper.createEventFunction('NodeIKernelSearchService/searchFileWithKeywords'); + let id = ''; + const Listener = this.core.eventWrapper.RegisterListen<(params: OnListener) => void> + ( + 'NodeIKernelSearchListener/onSearchFileKeywordsResult', + 1, + 20000, + (params) => id !== '' && params.searchId == id, + ); + id = await Event!(keys, 12); + const [ret] = (await Listener); + return ret; } + async getImageUrl(element: PicElement) { if (!element) { return ''; @@ -300,10 +317,12 @@ export class NTQQFileApi { export class NTQQFileCacheApi { context: InstanceContext; core: NapCatCore; + constructor(context: InstanceContext, core: NapCatCore) { this.context = context; this.core = core; } + async setCacheSilentScan(isSilent: boolean = true) { return ''; } @@ -313,7 +332,7 @@ export class NTQQFileCacheApi { } clearCache(cacheKeys: Array = ['tmp', 'hotUpdate']) { - // 参数未验证 + // 参数未验证 return this.context.session.getStorageCleanService().clearCacheDataByKeys(cacheKeys); } @@ -322,16 +341,16 @@ export class NTQQFileCacheApi { } scanCache() { - //return (await this.context.session.getStorageCleanService().scanCache()).size; + //return (await this.context.session.getStorageCleanService().scanCache()).size; } getHotUpdateCachePath() { - // 未实现 + // 未实现 return ''; } getDesktopTmpPath() { - // 未实现 + // 未实现 return ''; } @@ -341,8 +360,8 @@ export class NTQQFileCacheApi { getFileCacheInfo(fileType: CacheFileType, pageSize: number = 1000, lastRecord?: CacheFileListItem) { const _lastRecord = lastRecord ? lastRecord : { fileType: fileType }; - //需要五个参数 - //return napCatCore.session.getStorageCleanService().getFileCacheInfo(); + //需要五个参数 + //return napCatCore.session.getStorageCleanService().getFileCacheInfo(); } async clearChatCache(chats: ChatCacheListItemBasic[] = [], fileKeys: string[] = []) { diff --git a/src/core/apis/msg.ts b/src/core/apis/msg.ts index e8b26fb3..0465923b 100644 --- a/src/core/apis/msg.ts +++ b/src/core/apis/msg.ts @@ -1,23 +1,27 @@ import { GetFileListParam, Peer, RawMessage, SendMessageElement } from '@/core/entities'; -import { InstanceContext, NapCatCore, NTApiContext } from '@/core'; +import { InstanceContext, NapCatCore } from '@/core'; import { onGroupFileInfoUpdateParamType } from '@/core/listeners'; import { GeneralCallResult } from '@/core/services/common'; export class NTQQMsgApi { context: InstanceContext; core: NapCatCore; + constructor(context: InstanceContext, core: NapCatCore) { this.context = context; this.core = core; } + async FetchLongMsg(peer: Peer, msgId: string) { return this.context.session.getMsgService().fetchLongMsg(peer, msgId); } + async getMsgEmojiLikesList(peer: Peer, msgSeq: string, emojiId: string, emojiType: string, count: number = 20) { - //console.log(peer, msgSeq, emojiId, emojiType, count); - //注意此处emojiType 可选值一般为1-2 2好像是unicode表情dec值 大部分情况 Taged M likiowa - return this.context.session.getMsgService().getMsgEmojiLikesList(peer, msgSeq, emojiId, emojiType, "", false, 20); + //console.log(peer, msgSeq, emojiId, emojiType, count); + //注意此处emojiType 可选值一般为1-2 2好像是unicode表情dec值 大部分情况 Taged M likiowa + return this.context.session.getMsgService().getMsgEmojiLikesList(peer, msgSeq, emojiId, emojiType, '', false, 20); } + // napCatCore: NapCatCore | null = null; // enum BaseEmojiType { // NORMAL_EMOJI, @@ -27,20 +31,23 @@ export class NTQQMsgApi { // EMOJI_EMOJI // } async setEmojiLike(peer: Peer, msgSeq: string, emojiId: string, set: boolean = true) { - // nt_qq//global//nt_data//Emoji//emoji-resource//sysface_res/apng/ 下可以看到所有QQ表情预览 - // nt_qq\global\nt_data\Emoji\emoji-resource\face_config.json 里面有所有表情的id, 自带表情id是QSid, 标准emoji表情id是QCid - // 其实以官方文档为准是最好的,https://bot.q.qq.com/wiki/develop/api-v2/openapi/emoji/model.html#EmojiType + // nt_qq//global//nt_data//Emoji//emoji-resource//sysface_res/apng/ 下可以看到所有QQ表情预览 + // nt_qq\global\nt_data\Emoji\emoji-resource\face_config.json 里面有所有表情的id, 自带表情id是QSid, 标准emoji表情id是QCid + // 其实以官方文档为准是最好的,https://bot.q.qq.com/wiki/develop/api-v2/openapi/emoji/model.html#EmojiType emojiId = emojiId.toString(); return this.context.session.getMsgService().setMsgEmojiLikes(peer, msgSeq, emojiId, emojiId.length > 3 ? '2' : '1', set); } + async getMultiMsg(peer: Peer, rootMsgId: string, parentMsgId: string): Promise { + msgList: RawMessage[] + } | undefined> { return this.context.session.getMsgService().getMultiMsg(peer, rootMsgId, parentMsgId); } + async ForwardMsg(peer: Peer, msgIds: string[]) { return this.context.session.getMsgService().forwardMsg(msgIds, peer, [peer], new Map()); } + async getLastestMsgByUids(peer: Peer, count: number = 20, isReverseOrder: boolean = false) { const ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', { chatInfo: peer, @@ -54,18 +61,22 @@ export class NTQQMsgApi { }); return ret; } + async getMsgsByMsgId(peer: Peer | undefined, msgIds: string[] | undefined) { if (!peer) throw new Error('peer is not allowed'); if (!msgIds) throw new Error('msgIds is not allowed'); //Mlikiowa: 参数不合规会导致NC异常崩溃 原因是TX未对进入参数判断 对应Android标记@NotNull AndroidJADX分析可得 return await this.context.session.getMsgService().getMsgsByMsgId(peer, msgIds); } + async getSingleMsg(peer: Peer, seq: string) { return await this.context.session.getMsgService().getSingleMsg(peer, seq); } + async fetchFavEmojiList(num: number) { - return this.context.session.getMsgService().fetchFavEmojiList("", num, true, true); + return this.context.session.getMsgService().fetchFavEmojiList('', num, true, true); } + async queryMsgsWithFilterExWithSeq(peer: Peer, msgSeq: string) { const ret = await this.context.session.getMsgService().queryMsgsWithFilterEx('0', '0', msgSeq, { chatInfo: peer,//此处为Peer 为关键查询参数 没有啥也没有 by mlik iowa @@ -79,40 +90,46 @@ export class NTQQMsgApi { }); return ret; } + async getMsgsBySeqAndCount(peer: Peer, seq: string, count: number, desc: boolean, z: boolean) { return await this.context.session.getMsgService().getMsgsBySeqAndCount(peer, seq, count, desc, z); } + async setMsgRead(peer: Peer) { return this.context.session.getMsgService().setMsgRead(peer); } + async getGroupFileList(GroupCode: string, params: GetFileListParam) { const data = await this.core.eventWrapper.CallNormalEvent< - (GroupCode: string, params: GetFileListParam) => Promise, - (groupFileListResult: onGroupFileInfoUpdateParamType) => void - >( - 'NodeIKernelRichMediaService/getGroupFileList', - 'NodeIKernelMsgListener/onGroupFileInfoUpdate', - 1, - 5000, - (groupFileListResult: onGroupFileInfoUpdateParamType) => { - //Developer Mlikiowa Todo: 此处有问题 无法判断是否成功 - return true; - }, - GroupCode, - params - ); + (GroupCode: string, params: GetFileListParam) => Promise, + (groupFileListResult: onGroupFileInfoUpdateParamType) => void + >( + 'NodeIKernelRichMediaService/getGroupFileList', + 'NodeIKernelMsgListener/onGroupFileInfoUpdate', + 1, + 5000, + (groupFileListResult: onGroupFileInfoUpdateParamType) => { + //Developer Mlikiowa Todo: 此处有问题 无法判断是否成功 + return true; + }, + GroupCode, + params, + ); return data[1].item; } + async getMsgHistory(peer: Peer, msgId: string, count: number, isReverseOrder: boolean = false) { - // 消息时间从旧到新 + // 消息时间从旧到新 return this.context.session.getMsgService().getMsgsIncludeSelf(peer, msgId, count, isReverseOrder); } + async recallMsg(peer: Peer, msgIds: string[]) { await this.context.session.getMsgService().recallMsg({ chatType: peer.chatType, - peerUid: peer.peerUid + peerUid: peer.peerUid, }, msgIds); } + async sendMsgV2(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) { function generateMsgId() { const timestamp = Math.floor(Date.now() / 1000); @@ -120,9 +137,10 @@ export class NTQQMsgApi { const buffer = Buffer.alloc(8); buffer.writeUInt32BE(timestamp, 0); buffer.writeUInt32BE(random, 4); - const msgId = BigInt("0x" + buffer.toString('hex')).toString(); + const msgId = BigInt('0x' + buffer.toString('hex')).toString(); return msgId; } + // 此处有采用Hack方法 利用数据返回正确得到对应消息 // 与之前 Peer队列 MsgSeq队列 真正的MsgId并发不同 // 谨慎采用 目前测试暂无问题 Developer.Mlikiowa @@ -135,26 +153,26 @@ export class NTQQMsgApi { msgId = generateMsgId().toString(); } const data = await this.core.eventWrapper.CallNormalEvent< - (msgId: string, peer: Peer, msgElements: SendMessageElement[], map: Map) => Promise, - (msgList: RawMessage[]) => void - >( - 'NodeIKernelMsgService/sendMsg', - 'NodeIKernelMsgListener/onMsgInfoListUpdate', - 1, - timeout, - (msgRecords: RawMessage[]) => { - for (const msgRecord of msgRecords) { - if (msgRecord.msgId === msgId && msgRecord.sendStatus === 2) { - return true; - } - } - return false; - }, - msgId, - peer, - msgElements, - new Map() - ); + (msgId: string, peer: Peer, msgElements: SendMessageElement[], map: Map) => Promise, + (msgList: RawMessage[]) => void + >( + 'NodeIKernelMsgService/sendMsg', + 'NodeIKernelMsgListener/onMsgInfoListUpdate', + 1, + timeout, + (msgRecords: RawMessage[]) => { + for (const msgRecord of msgRecords) { + if (msgRecord.msgId === msgId && msgRecord.sendStatus === 2) { + return true; + } + } + return false; + }, + msgId, + peer, + msgElements, + new Map(), + ); const retMsg = data[1].find(msgRecord => { if (msgRecord.msgId === msgId) { return true; @@ -162,34 +180,36 @@ export class NTQQMsgApi { }); return retMsg; } + sendMsgEx(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) { - //return NTQQMsgApi.sendMsgV1(peer, msgElements, waitComplete, timeout); + //return NTQQMsgApi.sendMsgV1(peer, msgElements, waitComplete, timeout); } + async sendMsg(peer: Peer, msgElements: SendMessageElement[], waitComplete = true, timeout = 10000) { - //唉? !我有个想法 + //唉? !我有个想法 const msgId = await this.getMsgUnique(peer.chatType, await this.getServerTime()); peer.guildId = msgId; const data = await this.core.eventWrapper.CallNormalEvent< - (msgId: string, peer: Peer, msgElements: SendMessageElement[], map: Map) => Promise, - (msgList: RawMessage[]) => void - >( - 'NodeIKernelMsgService/sendMsg', - 'NodeIKernelMsgListener/onMsgInfoListUpdate', - 1, - timeout, - (msgRecords: RawMessage[]) => { - for (const msgRecord of msgRecords) { - if (msgRecord.guildId === msgId && msgRecord.sendStatus === 2) { - return true; - } - } - return false; - }, - "0", - peer, - msgElements, - new Map() - ); + (msgId: string, peer: Peer, msgElements: SendMessageElement[], map: Map) => Promise, + (msgList: RawMessage[]) => void + >( + 'NodeIKernelMsgService/sendMsg', + 'NodeIKernelMsgListener/onMsgInfoListUpdate', + 1, + timeout, + (msgRecords: RawMessage[]) => { + for (const msgRecord of msgRecords) { + if (msgRecord.guildId === msgId && msgRecord.sendStatus === 2) { + return true; + } + } + return false; + }, + '0', + peer, + msgElements, + new Map(), + ); const retMsg = data[1].find(msgRecord => { if (msgRecord.guildId === msgId) { return true; @@ -197,47 +217,52 @@ export class NTQQMsgApi { }); return retMsg; } + async getMsgUnique(chatType: number, time: string) { if (this.context.basicInfoWrapper.requireMinNTQQBuild('26702')) { return this.context.session.getMsgService().generateMsgUniqueId(chatType, time); } return this.context.session.getMsgService().getMsgUniqueId(time); } + async getServerTime() { return this.context.session.getMSFService().getServerTime(); } + async getServerTimeV2() { return this.core.eventWrapper.callNoListenerEvent<() => string>('NodeIKernelMsgService/getServerTime', 5000); } + async forwardMsg(srcPeer: Peer, destPeer: Peer, msgIds: string[]) { return this.context.session.getMsgService().forwardMsg(msgIds, srcPeer, [destPeer], new Map()); } + async multiForwardMsg(srcPeer: Peer, destPeer: Peer, msgIds: string[]): Promise { const msgInfos = msgIds.map(id => { return { msgId: id, senderShowName: this.core.selfInfo.nick }; }); const data = await this.core.eventWrapper.CallNormalEvent< - (msgInfo: typeof msgInfos, srcPeer: Peer, destPeer: Peer, comment: Array, attr: Map,) => Promise, - (msgList: RawMessage[]) => void - >( - 'NodeIKernelMsgService/multiForwardMsgWithComment', - 'NodeIKernelMsgListener/onMsgInfoListUpdate', - 1, - 5000, - (msgRecords: RawMessage[]) => { - for (const msgRecord of msgRecords) { - if (msgRecord.peerUid == destPeer.peerUid && msgRecord.senderUid == this.core.selfInfo.uid) { - return true; - } - } - return false; - }, - msgInfos, - srcPeer, - destPeer, - [], - new Map() - ); + (msgInfo: typeof msgInfos, srcPeer: Peer, destPeer: Peer, comment: Array, attr: Map) => Promise, + (msgList: RawMessage[]) => void + >( + 'NodeIKernelMsgService/multiForwardMsgWithComment', + 'NodeIKernelMsgListener/onMsgInfoListUpdate', + 1, + 5000, + (msgRecords: RawMessage[]) => { + for (const msgRecord of msgRecords) { + if (msgRecord.peerUid == destPeer.peerUid && msgRecord.senderUid == this.core.selfInfo.uid) { + return true; + } + } + return false; + }, + msgInfos, + srcPeer, + destPeer, + [], + new Map(), + ); for (const msg of data[1]) { const arkElement = msg.elements.find(ele => ele.arkElement); if (!arkElement) { @@ -253,6 +278,7 @@ export class NTQQMsgApi { } throw new Error('转发消息超时'); } + async markallMsgAsRead() { return this.context.session.getMsgService().setAllC2CAndGroupMsgRead(); } diff --git a/src/core/apis/user.ts b/src/core/apis/user.ts index 0a54cf05..3799ed7d 100644 --- a/src/core/apis/user.ts +++ b/src/core/apis/user.ts @@ -275,9 +275,11 @@ export class NTQQUserApi { } return uid; } - + async getUinByUidV1(Uid: string) { - const ret = await this.core.eventWrapper.callNoListenerEvent<(Uin: string[]) => Promise<{ uinInfo: Map }>> + const ret = await this.core.eventWrapper.callNoListenerEvent<(Uin: string[]) => Promise<{ + uinInfo: Map + }>> ('NodeIKernelUixConvertService/getUin', 5000, [Uid]); let uin = ret.uinInfo.get(Uid); if (!uin) { @@ -317,6 +319,7 @@ export class NTQQUserApi { return this.core.eventWrapper.callNoListenerEvent<(Uin: string) => Promise> ('NodeIKernelProfileService/getUserDetailInfoByUin', 5000, Uin); } + async forceFetchClientKey() { return await this.context.session.getTicketService().forceFetchClientKey(''); } diff --git a/src/core/apis/webapi.ts b/src/core/apis/webapi.ts index dafc1041..36f55a42 100644 --- a/src/core/apis/webapi.ts +++ b/src/core/apis/webapi.ts @@ -71,7 +71,7 @@ export class NTQQWebApi { end: '40', sort: '1', gc: GroupCode, - bkn: this.getBknFromCookie(cookieObject) + bkn: this.getBknFromCookie(cookieObject), }).toString() }`, 'POST', '', { 'Cookie': this.cookieToString(cookieObject) }); if (!fastRet?.count || fastRet?.errcode !== 0 || !fastRet?.mems) { @@ -92,7 +92,7 @@ export class NTQQWebApi { end: (i * 40).toString(), sort: '1', gc: GroupCode, - bkn: this.getBknFromCookie(cookieObject) + bkn: this.getBknFromCookie(cookieObject), }).toString() }`, 'POST', '', { 'Cookie': this.cookieToString(cookieObject) }); retList.push(ret); @@ -288,10 +288,10 @@ export class NTQQWebApi { private cookieToString(cookieObject: any) { return Object.entries(cookieObject).map(([key, value]) => `${key}=${value}`).join('; '); } - + public getBknFromCookie(cookieObject: any) { const sKey = cookieObject.skey as string; - + let hash = 5381; for (let i = 0; i < sKey.length; i++) { const code = sKey.charCodeAt(i); diff --git a/src/core/core.ts b/src/core/core.ts index f9f4234b..17d0c36d 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -1,16 +1,15 @@ -import { NTApiContext, WrapperNodeApi } from "@/core/wrapper"; -import path from "node:path"; -import fs from "node:fs"; -import { InstanceContext } from "./wrapper"; -import { NTEventChannel } from "@/common/framework/event"; -import { proxiedListenerOf } from "@/common/utils/proxy-handler"; -import { MsgListener, ProfileListener } from "./listeners"; -import { sleep } from "@/common/utils/helper"; -import { SelfInfo, LineDevice, SelfStatusInfo } from "./entities"; -import { LegacyNTEventWrapper } from "@/common/framework/event-legacy"; -import { NTQQFileApi, NTQQFriendApi, NTQQGroupApi, NTQQMsgApi, NTQQSystemApi, NTQQUserApi, NTQQWebApi } from "./apis"; -import os from "node:os"; -import { NTQQCollectionApi } from "./apis/collection"; +import { NTApiContext, WrapperNodeApi } from '@/core/wrapper'; +import path from 'node:path'; +import fs from 'node:fs'; +import { InstanceContext } from './wrapper'; +import { proxiedListenerOf } from '@/common/utils/proxy-handler'; +import { MsgListener, ProfileListener } from './listeners'; +import { SelfInfo, SelfStatusInfo } from './entities'; +import { LegacyNTEventWrapper } from '@/common/framework/event-legacy'; +import { NTQQFileApi, NTQQFriendApi, NTQQGroupApi, NTQQMsgApi, NTQQSystemApi, NTQQUserApi, NTQQWebApi } from './apis'; +import os from 'node:os'; +import { NTQQCollectionApi } from './apis/collection'; + export enum NapCatCoreWorkingEnv { Unknown = 0, Shell = 1, @@ -36,6 +35,7 @@ export class NapCatCore { NapCatTempPath: string; // runtime info, not readonly selfInfo: SelfInfo; + // 通过构造器递过去的 runtime info 应该尽量少 constructor(context: InstanceContext, selfInfo: SelfInfo) { this.selfInfo = selfInfo; @@ -50,7 +50,7 @@ export class NapCatCore { FriendApi: new NTQQFriendApi(this.context, this), MsgApi: new NTQQMsgApi(this.context, this), UserApi: new NTQQUserApi(this.context, this), - GroupApi: new NTQQGroupApi(this.context, this) + GroupApi: new NTQQGroupApi(this.context, this), }; this.NapCatDataPath = path.join(this.dataPath, 'NapCat'); fs.mkdirSync(this.NapCatDataPath, { recursive: true }); @@ -60,9 +60,11 @@ export class NapCatCore { fs.mkdirSync(this.NapCatTempPath, { recursive: true }); } } + getApiContext() { return this.ApiContext; } + get dataPath(): string { let result = this.context.wrapper.util.getNTUserDataInfoConfig(); if (!result) { @@ -76,11 +78,11 @@ export class NapCatCore { async initNapCatCoreListeners() { const msgListener = new MsgListener(); msgListener.onRecvMsg = (msg) => { - console.log("RecvMsg", msg); + console.log('RecvMsg', msg); }; //await sleep(2500); this.context.session.getMsgService().addKernelMsgListener( - new this.context.wrapper.NodeIKernelMsgListener(proxiedListenerOf(msgListener, this.context.logger)) + new this.context.wrapper.NodeIKernelMsgListener(proxiedListenerOf(msgListener, this.context.logger)), ); const profileListener = new ProfileListener(); @@ -95,7 +97,7 @@ export class NapCatCore { // } }; this.context.session.getProfileService().addKernelProfileListener( - new this.context.wrapper.NodeIKernelProfileListener(proxiedListenerOf(profileListener, this.context.logger)) + new this.context.wrapper.NodeIKernelProfileListener(proxiedListenerOf(profileListener, this.context.logger)), ); } } diff --git a/src/core/entities/cache.ts b/src/core/entities/cache.ts index ce4ef9a7..8e4cf813 100644 --- a/src/core/entities/cache.ts +++ b/src/core/entities/cache.ts @@ -12,12 +12,12 @@ export interface CacheScanResult { string, // 「缓存数据」大小 string, // 「其他数据」大小 string, // 未知 - ] + ]; } export interface ChatCacheList { pageCount: number; - infos: ChatCacheListItem[] + infos: ChatCacheListItem[]; } export interface ChatCacheListItem { diff --git a/src/core/entities/group.ts b/src/core/entities/group.ts index 43688fa2..aba45f02 100644 --- a/src/core/entities/group.ts +++ b/src/core/entities/group.ts @@ -1,10 +1,12 @@ import { QQLevel, Sex } from './user'; + export enum GroupListUpdateType { REFRESHALL, GETALL, MODIFIED, REMOVE } + export interface Group { groupCode: string, createTime?: string,//高版本才有 @@ -56,9 +58,9 @@ export interface GroupMember { uid: string; // 加密的字符串 uin: string; // QQ号 isRobot: boolean; - sex?: Sex - qqLevel?: QQLevel + sex?: Sex; + qqLevel?: QQLevel; isChangeRole: boolean; joinTime: string; lastSpeakTime: string; -} \ No newline at end of file +} diff --git a/src/core/entities/msg.ts b/src/core/entities/msg.ts index d0c2223b..a73d5cc7 100644 --- a/src/core/entities/msg.ts +++ b/src/core/entities/msg.ts @@ -1,591 +1,633 @@ import { GroupMemberRole } from './group'; export interface Peer { - chatType: ChatType; - peerUid: string; // 如果是群聊uid为群号,私聊uid就是加密的字符串 - guildId?: string; + chatType: ChatType; + peerUid: string; // 如果是群聊uid为群号,私聊uid就是加密的字符串 + guildId?: string; } + export interface KickedOffLineInfo { - appId: number - instanceId: number - sameDevice: boolean - tipsDesc: string - tipsTitle: string - kickedType: number - securityKickedType: number + appId: number; + instanceId: number; + sameDevice: boolean; + tipsDesc: string; + tipsTitle: string; + kickedType: number; + securityKickedType: number; } + export interface GetFileListParam { - sortType: number - fileCount: number - startIndex: number - sortOrder: number - showOnlinedocFolder: number + sortType: number; + fileCount: number; + startIndex: number; + sortOrder: number; + showOnlinedocFolder: number; } + export enum ElementType { - UNKNOWN = 0, - TEXT = 1, - PIC = 2, - FILE = 3, - PTT = 4, - VIDEO = 5, - FACE = 6, - REPLY = 7, - WALLET = 9, - GreyTip = 8,//Poke别叫戳一搓了 官方名字拍一拍 戳一戳是另一个名字 - ARK = 10, - MFACE = 11, - LIVEGIFT = 12, - STRUCTLONGMSG = 13, - MARKDOWN = 14, - GIPHY = 15, - MULTIFORWARD = 16, - INLINEKEYBOARD = 17, - INTEXTGIFT = 18, - CALENDAR = 19, - YOLOGAMERESULT = 20, - AVRECORD = 21, - FEED = 22, - TOFURECORD = 23, - ACEBUBBLE = 24, - ACTIVITY = 25, - TOFU = 26, - FACEBUBBLE = 27, - SHARELOCATION = 28, - TASKTOPMSG = 29, - RECOMMENDEDMSG = 43, - ACTIONBAR = 44 -} + UNKNOWN = 0, + TEXT = 1, + PIC = 2, + FILE = 3, + PTT = 4, + VIDEO = 5, + FACE = 6, + REPLY = 7, + WALLET = 9, + GreyTip = 8,//Poke别叫戳一搓了 官方名字拍一拍 戳一戳是另一个名字 + ARK = 10, + MFACE = 11, + LIVEGIFT = 12, + STRUCTLONGMSG = 13, + MARKDOWN = 14, + GIPHY = 15, + MULTIFORWARD = 16, + INLINEKEYBOARD = 17, + INTEXTGIFT = 18, + CALENDAR = 19, + YOLOGAMERESULT = 20, + AVRECORD = 21, + FEED = 22, + TOFURECORD = 23, + ACEBUBBLE = 24, + ACTIVITY = 25, + TOFU = 26, + FACEBUBBLE = 27, + SHARELOCATION = 28, + TASKTOPMSG = 29, + RECOMMENDEDMSG = 43, + ACTIONBAR = 44 +} + export interface ActionBarElement { - rows: InlineKeyboardRow[]; - botAppid: string; + rows: InlineKeyboardRow[]; + botAppid: string; } + export interface SendActionBarElement { - elementType: ElementType.ACTIONBAR; - elementId: string; - actionBarElement: ActionBarElement; + elementType: ElementType.ACTIONBAR; + elementId: string; + actionBarElement: ActionBarElement; } + export interface RecommendedMsgElement { - rows: InlineKeyboardRow[]; - botAppid: string; + rows: InlineKeyboardRow[]; + botAppid: string; } + export interface SendRecommendedMsgElement { - elementType: ElementType.RECOMMENDEDMSG; - elementId: string; - recommendedMsgElement: RecommendedMsgElement; + elementType: ElementType.RECOMMENDEDMSG; + elementId: string; + recommendedMsgElement: RecommendedMsgElement; } + export interface InlineKeyboardButton { - id: string; - label: string; - visitedLabel: string; - unsupportTips: string; - data: string; - specifyRoleIds: string[]; - specifyTinyids: string[]; - style: number; - type: number; - clickLimit: number; - atBotShowChannelList: boolean; - permissionType: number; + id: string; + label: string; + visitedLabel: string; + unsupportTips: string; + data: string; + specifyRoleIds: string[]; + specifyTinyids: string[]; + style: number; + type: number; + clickLimit: number; + atBotShowChannelList: boolean; + permissionType: number; } + export interface InlineKeyboardRow { - buttons: InlineKeyboardButton[]; + buttons: InlineKeyboardButton[]; } + export interface TofuElementContent { - color: string; - tittle: string; + color: string; + tittle: string; } + export interface TaskTopMsgElement { - msgTitle: string; - msgSummary: string; - iconUrl: string; - topMsgType: number; + msgTitle: string; + msgSummary: string; + iconUrl: string; + topMsgType: number; } + export interface SendTaskTopMsgElement { - elementType: ElementType.TASKTOPMSG; - elementId: string; - taskTopMsgElement: TaskTopMsgElement; + elementType: ElementType.TASKTOPMSG; + elementId: string; + taskTopMsgElement: TaskTopMsgElement; } + export interface TofuRecordElement { - type: number; - busiid: string; - busiuuid: string; - descriptionContent: string; - contentlist: TofuElementContent[], - background: string; - icon: string; - uinlist: string[], - uidlist: string[], - busiExtra: string; - updateTime: string; - dependedmsgid: string; - msgtime: string; - onscreennotify: boolean; + type: number; + busiid: string; + busiuuid: string; + descriptionContent: string; + contentlist: TofuElementContent[], + background: string; + icon: string; + uinlist: string[], + uidlist: string[], + busiExtra: string; + updateTime: string; + dependedmsgid: string; + msgtime: string; + onscreennotify: boolean; } + export interface SendTofuRecordElement { - elementType: ElementType.TOFURECORD; - elementId: string; - tofuRecordElement: TofuRecordElement; + elementType: ElementType.TOFURECORD; + elementId: string; + tofuRecordElement: TofuRecordElement; } export interface FaceBubbleElement { - faceCount: number; - faceSummary: string; - faceFlag: number; - content: string; - oldVersionStr: string; - faceType: number; - others: string; - yellowFaceInfo: { - index: number; - buf: string; - compatibleText: string; - text: string; - } + faceCount: number; + faceSummary: string; + faceFlag: number; + content: string; + oldVersionStr: string; + faceType: number; + others: string; + yellowFaceInfo: { + index: number; + buf: string; + compatibleText: string; + text: string; + }; } + export interface SendFaceBubbleElement { - elementType: ElementType.FACEBUBBLE; - elementId: string; - faceBubbleElement: FaceBubbleElement; + elementType: ElementType.FACEBUBBLE; + elementId: string; + faceBubbleElement: FaceBubbleElement; } + export interface AvRecordElement { - type: number; - time: string; - text: string; - mainType: number; - hasRead: boolean; - extraType: number; + type: number; + time: string; + text: string; + mainType: number; + hasRead: boolean; + extraType: number; } + export interface SendavRecordElement { - elementType: ElementType.AVRECORD; - elementId: string; - avRecordElement: AvRecordElement; + elementType: ElementType.AVRECORD; + elementId: string; + avRecordElement: AvRecordElement; } + export interface YoloUserInfo { - uid: string; - result: number; - rank: number; - bizId: string + uid: string; + result: number; + rank: number; + bizId: string; } + export interface SendInlineKeyboardElement { - elementType: ElementType.INLINEKEYBOARD; - elementId: string; - inlineKeyboardElement: { - rows: number; - botAppid: string; - } + elementType: ElementType.INLINEKEYBOARD; + elementId: string; + inlineKeyboardElement: { + rows: number; + botAppid: string; + }; } + export interface YoloGameResultElement { - UserInfo: YoloUserInfo[]; + UserInfo: YoloUserInfo[]; } + export interface SendYoloGameResultElement { - elementType: ElementType.YOLOGAMERESULT; - yoloGameResultElement: YoloGameResultElement + elementType: ElementType.YOLOGAMERESULT; + yoloGameResultElement: YoloGameResultElement; } + export interface GiphyElement { - id: string; - isClip: boolean; - width: number; - height: number; + id: string; + isClip: boolean; + width: number; + height: number; } + export interface SendGiphyElement { - elementType: ElementType.GIPHY; - elementId: string; - giphyElement: GiphyElement; + elementType: ElementType.GIPHY; + elementId: string; + giphyElement: GiphyElement; } + export interface SendWalletElement { - elementType: ElementType.UNKNOWN;//不做 设置位置 - elementId: string; - walletElement: {} + elementType: ElementType.UNKNOWN;//不做 设置位置 + elementId: string; + walletElement: Record; } + export interface CalendarElement { - summary: string; - msg: string; - expireTimeMs: string; - schemaType: number; - schema: string + summary: string; + msg: string; + expireTimeMs: string; + schemaType: number; + schema: string; } + export interface SendCalendarElement { - elementType: ElementType.CALENDAR; - elementId: string; - calendarElement: CalendarElement; + elementType: ElementType.CALENDAR; + elementId: string; + calendarElement: CalendarElement; } + export interface SendliveGiftElement { - elementType: ElementType.LIVEGIFT; - elementId: string; - liveGiftElement: {} + elementType: ElementType.LIVEGIFT; + elementId: string; + liveGiftElement: Record; } + export interface SendTextElement { - elementType: ElementType.TEXT; - elementId: string; - textElement: { + elementType: ElementType.TEXT; + elementId: string; + textElement: { + content: string; + atType: number; + atUid: string; + atTinyId: string; + atNtUid: string; + }; +} + +export interface SendPttElement { + elementType: ElementType.PTT; + elementId: string; + pttElement: { + fileName: string; + filePath: string; + md5HexStr: string; + fileSize: number; + duration: number; // 单位是秒 + formatType: number; + voiceType: number; + voiceChangeType: number; + canConvert2Text: boolean; + waveAmplitudes: number[]; + fileSubId: string; + playState: number; + autoConvertText: number; + }; +} + +export enum PicType { + gif = 2000, + jpg = 1000 +} + +export enum PicSubType { + normal = 0, // 普通图片,大图 + face = 1 // 表情包小图 +} + +export interface SendPicElement { + elementType: ElementType.PIC; + elementId: string; + picElement: PicElement; +} + +export interface ReplyElement { + replayMsgSeq: string; + replayMsgId: string; + senderUin: string; + senderUinStr: string; +} + +export interface SendReplyElement { + elementType: ElementType.REPLY; + elementId: string; + replyElement: ReplyElement; +} + +export interface SendFaceElement { + elementType: ElementType.FACE; + elementId: string; + faceElement: FaceElement; +} + +export interface SendMarketFaceElement { + elementType: ElementType.MFACE; + marketFaceElement: MarketFaceElement; +} + +export interface SendstructLongMsgElement { + elementType: ElementType.STRUCTLONGMSG; + elementId: string; + structLongMsgElement: StructLongMsgElement; +} + +export interface StructLongMsgElement { + xmlContent: string; + resId: string; +} + +export interface SendactionBarElement { + elementType: ElementType.ACTIONBAR; + elementId: string; + actionBarElement: { + rows: number; + botAppid: string; + }; +} + +export interface ShareLocationElement { + text: string; + ext: string; +} + +export interface sendShareLocationElement { + elementType: ElementType.SHARELOCATION; + elementId: string; + shareLocationElement?: ShareLocationElement; +} + +export interface FileElement { + fileMd5?: string; + fileName: string; + filePath: string; + fileSize: string; + picHeight?: number; + picWidth?: number; + folderId?: string; + picThumbPath?: Map; + file10MMd5?: string; + fileSha?: string; + fileSha3?: string; + fileUuid?: string; + fileSubId?: string; + thumbFileSize?: number; + fileBizId?: number; +} + +export interface SendFileElement { + elementType: ElementType.FILE; + elementId: string; + fileElement: FileElement; +} + +export interface SendVideoElement { + elementType: ElementType.VIDEO; + elementId: string; + videoElement: VideoElement; +} + +export interface SendArkElement { + elementType: ElementType.ARK; + elementId: string; + arkElement: ArkElement; +} + +export interface SendMarkdownElement { + elementType: ElementType.MARKDOWN; + elementId: string; + markdownElement: MarkdownElement; +} + +export type SendMessageElement = SendTextElement | SendPttElement | + SendPicElement | SendReplyElement | SendFaceElement | SendMarketFaceElement | SendFileElement | + SendVideoElement | SendArkElement | SendMarkdownElement | sendShareLocationElement; + +export interface TextElement { content: string; atType: number; atUid: string; atTinyId: string; atNtUid: string; - }; } -export interface SendPttElement { - elementType: ElementType.PTT; - elementId: string; - pttElement: { - fileName: string; - filePath: string; - md5HexStr: string; - fileSize: number; - duration: number; // 单位是秒 - formatType: number; - voiceType: number; - voiceChangeType: number; - canConvert2Text: boolean; - waveAmplitudes: number[]; - fileSubId: string; - playState: number; - autoConvertText: number; - }; -} - -export enum PicType { - gif = 2000, - jpg = 1000 -} - -export enum PicSubType { - normal = 0, // 普通图片,大图 - face = 1 // 表情包小图 -} - -export interface SendPicElement { - elementType: ElementType.PIC; - elementId: string; - picElement:PicElement -} -export interface ReplyElement { - replayMsgSeq: string; - replayMsgId: string; - senderUin: string; - senderUinStr: string; -} -export interface SendReplyElement { - elementType: ElementType.REPLY; - elementId: string; - replyElement: ReplyElement -} - -export interface SendFaceElement { - elementType: ElementType.FACE; - elementId: string; - faceElement: FaceElement; -} - -export interface SendMarketFaceElement { - elementType: ElementType.MFACE; - marketFaceElement: MarketFaceElement; -} -export interface SendstructLongMsgElement { - elementType: ElementType.STRUCTLONGMSG; - elementId: string; - structLongMsgElement: StructLongMsgElement; -} -export interface StructLongMsgElement { - xmlContent: string; - resId: string; -} -export interface SendactionBarElement { - elementType: ElementType.ACTIONBAR; - elementId: string; - actionBarElement: { - rows: number; - botAppid: string; - } -} -export interface ShareLocationElement { - text: string; - ext: string; -} -export interface sendShareLocationElement { - elementType: ElementType.SHARELOCATION; - elementId: string; - shareLocationElement?: ShareLocationElement; -} - -export interface FileElement { - fileMd5?: string; - fileName: string; - filePath: string; - fileSize: string; - picHeight?: number; - picWidth?: number; - folderId?: string; - picThumbPath?: Map; - file10MMd5?: string; - fileSha?: string; - fileSha3?: string; - fileUuid?: string; - fileSubId?: string; - thumbFileSize?: number; - fileBizId?: number -} - -export interface SendFileElement { - elementType: ElementType.FILE; - elementId: string; - fileElement: FileElement; -} - -export interface SendVideoElement { - elementType: ElementType.VIDEO; - elementId: string; - videoElement: VideoElement; -} - -export interface SendArkElement { - elementType: ElementType.ARK; - elementId: string; - arkElement: ArkElement; -} - -export interface SendMarkdownElement { - elementType: ElementType.MARKDOWN; - elementId: string; - markdownElement: MarkdownElement; -} -export type SendMessageElement = SendTextElement | SendPttElement | - SendPicElement | SendReplyElement | SendFaceElement | SendMarketFaceElement | SendFileElement | - SendVideoElement | SendArkElement | SendMarkdownElement | sendShareLocationElement; - -export interface TextElement { - content: string; - atType: number; - atUid: string; - atTinyId: string; - atNtUid: string; -} export interface MessageElement { - elementType: ElementType, - elementId: string, - extBufForUI: string,//"0x", - textElement?: TextElement; - faceElement?: FaceElement, - marketFaceElement?: MarkdownElement, - replyElement?: ReplyElement, - picElement?: PicElement, - pttElement?: PttElement, - videoElement?: VideoElement, - grayTipElement?: GrayTipElement, - arkElement?: ArkElement, - fileElement?: FileElement, - liveGiftElement?: null, - markdownElement?: MarkdownElement, - structLongMsgElement?: StructLongMsgElement, - multiForwardMsgElement?: MultiForwardMsgElement, - giphyElement?: GiphyElement, - walletElement?: null, - inlineKeyboardElement?: InlineKeyboardElement, - textGiftElement?: null,//???? - calendarElement?: CalendarElement, - yoloGameResultElement?: YoloGameResultElement, - avRecordElement?: AvRecordElement, - structMsgElement?: null, - faceBubbleElement?: FaceBubbleElement, - shareLocationElement?: ShareLocationElement, - tofuRecordElement?: TofuRecordElement, - taskTopMsgElement?: TaskTopMsgElement, - recommendedMsgElement?: RecommendedMsgElement, - actionBarElement?:ActionBarElement + elementType: ElementType, + elementId: string, + extBufForUI: string,//"0x", + textElement?: TextElement; + faceElement?: FaceElement, + marketFaceElement?: MarkdownElement, + replyElement?: ReplyElement, + picElement?: PicElement, + pttElement?: PttElement, + videoElement?: VideoElement, + grayTipElement?: GrayTipElement, + arkElement?: ArkElement, + fileElement?: FileElement, + liveGiftElement?: null, + markdownElement?: MarkdownElement, + structLongMsgElement?: StructLongMsgElement, + multiForwardMsgElement?: MultiForwardMsgElement, + giphyElement?: GiphyElement, + walletElement?: null, + inlineKeyboardElement?: InlineKeyboardElement, + textGiftElement?: null,//???? + calendarElement?: CalendarElement, + yoloGameResultElement?: YoloGameResultElement, + avRecordElement?: AvRecordElement, + structMsgElement?: null, + faceBubbleElement?: FaceBubbleElement, + shareLocationElement?: ShareLocationElement, + tofuRecordElement?: TofuRecordElement, + taskTopMsgElement?: TaskTopMsgElement, + recommendedMsgElement?: RecommendedMsgElement, + actionBarElement?: ActionBarElement } + export enum AtType { - notAt = 0, - atAll = 1, - atUser = 2 + notAt = 0, + atAll = 1, + atUser = 2 } export enum ChatType { - friend = 1, - group = 2, - chatDevice = 8, //移动设备? - temp = 100 + friend = 1, + group = 2, + chatDevice = 8, //移动设备? + temp = 100 } + // 来自Android分析 export enum ChatType2 { - KCHATTYPEADELIE = 42, - KCHATTYPEBUDDYNOTIFY = 5, - KCHATTYPEC2C = 1, - KCHATTYPECIRCLE = 113, - KCHATTYPEDATALINE = 8, - KCHATTYPEDATALINEMQQ = 134, - KCHATTYPEDISC = 3, - KCHATTYPEFAV = 41, - KCHATTYPEGAMEMESSAGE = 105, - KCHATTYPEGAMEMESSAGEFOLDER = 116, - KCHATTYPEGROUP = 2, - KCHATTYPEGROUPBLESS = 133, - KCHATTYPEGROUPGUILD = 9, - KCHATTYPEGROUPHELPER = 7, - KCHATTYPEGROUPNOTIFY = 6, - KCHATTYPEGUILD = 4, - KCHATTYPEGUILDMETA = 16, - KCHATTYPEMATCHFRIEND = 104, - KCHATTYPEMATCHFRIENDFOLDER = 109, - KCHATTYPENEARBY = 106, - KCHATTYPENEARBYASSISTANT = 107, - KCHATTYPENEARBYFOLDER = 110, - KCHATTYPENEARBYHELLOFOLDER = 112, - KCHATTYPENEARBYINTERACT = 108, - KCHATTYPEQQNOTIFY = 132, - KCHATTYPERELATEACCOUNT = 131, - KCHATTYPESERVICEASSISTANT = 118, - KCHATTYPESERVICEASSISTANTSUB = 201, - KCHATTYPESQUAREPUBLIC = 115, - KCHATTYPESUBSCRIBEFOLDER = 30, - KCHATTYPETEMPADDRESSBOOK = 111, - KCHATTYPETEMPBUSSINESSCRM = 102, - KCHATTYPETEMPC2CFROMGROUP = 100, - KCHATTYPETEMPC2CFROMUNKNOWN = 99, - KCHATTYPETEMPFRIENDVERIFY = 101, - KCHATTYPETEMPNEARBYPRO = 119, - KCHATTYPETEMPPUBLICACCOUNT = 103, - KCHATTYPETEMPWPA = 117, - KCHATTYPEUNKNOWN = 0, - KCHATTYPEWEIYUN = 40, + KCHATTYPEADELIE = 42, + KCHATTYPEBUDDYNOTIFY = 5, + KCHATTYPEC2C = 1, + KCHATTYPECIRCLE = 113, + KCHATTYPEDATALINE = 8, + KCHATTYPEDATALINEMQQ = 134, + KCHATTYPEDISC = 3, + KCHATTYPEFAV = 41, + KCHATTYPEGAMEMESSAGE = 105, + KCHATTYPEGAMEMESSAGEFOLDER = 116, + KCHATTYPEGROUP = 2, + KCHATTYPEGROUPBLESS = 133, + KCHATTYPEGROUPGUILD = 9, + KCHATTYPEGROUPHELPER = 7, + KCHATTYPEGROUPNOTIFY = 6, + KCHATTYPEGUILD = 4, + KCHATTYPEGUILDMETA = 16, + KCHATTYPEMATCHFRIEND = 104, + KCHATTYPEMATCHFRIENDFOLDER = 109, + KCHATTYPENEARBY = 106, + KCHATTYPENEARBYASSISTANT = 107, + KCHATTYPENEARBYFOLDER = 110, + KCHATTYPENEARBYHELLOFOLDER = 112, + KCHATTYPENEARBYINTERACT = 108, + KCHATTYPEQQNOTIFY = 132, + KCHATTYPERELATEACCOUNT = 131, + KCHATTYPESERVICEASSISTANT = 118, + KCHATTYPESERVICEASSISTANTSUB = 201, + KCHATTYPESQUAREPUBLIC = 115, + KCHATTYPESUBSCRIBEFOLDER = 30, + KCHATTYPETEMPADDRESSBOOK = 111, + KCHATTYPETEMPBUSSINESSCRM = 102, + KCHATTYPETEMPC2CFROMGROUP = 100, + KCHATTYPETEMPC2CFROMUNKNOWN = 99, + KCHATTYPETEMPFRIENDVERIFY = 101, + KCHATTYPETEMPNEARBYPRO = 119, + KCHATTYPETEMPPUBLICACCOUNT = 103, + KCHATTYPETEMPWPA = 117, + KCHATTYPEUNKNOWN = 0, + KCHATTYPEWEIYUN = 40, } export interface PttElement { - canConvert2Text: boolean; - duration: number; // 秒数 - fileBizId: null; - fileId: number; // 0 - fileName: string; // "e4d09c784d5a2abcb2f9980bdc7acfe6.amr" - filePath: string; // "/Users//Library/Containers/com.tencent.qq/Data/Library/Application Support/QQ/nt_qq_a6b15c9820595d25a56c1633ce19ad40/nt_data/Ptt/2023-11/Ori/e4d09c784d5a2abcb2f9980bdc7acfe6.amr" - fileSize: string; // "4261" - fileSubId: string; // "0" - fileUuid: string; // "90j3z7rmRphDPrdVgP9udFBaYar#oK0TWZIV" - formatType: string; // 1 - invalidState: number; // 0 - md5HexStr: string; // "e4d09c784d5a2abcb2f9980bdc7acfe6" - playState: number; // 0 - progress: number; // 0 - text: string; // "" - transferStatus: number; // 0 - translateStatus: number; // 0 - voiceChangeType: number; // 0 - voiceType: number; // 0 - waveAmplitudes: number[]; + canConvert2Text: boolean; + duration: number; // 秒数 + fileBizId: null; + fileId: number; // 0 + fileName: string; // "e4d09c784d5a2abcb2f9980bdc7acfe6.amr" + filePath: string; // "/Users//Library/Containers/com.tencent.qq/Data/Library/Application Support/QQ/nt_qq_a6b15c9820595d25a56c1633ce19ad40/nt_data/Ptt/2023-11/Ori/e4d09c784d5a2abcb2f9980bdc7acfe6.amr" + fileSize: string; // "4261" + fileSubId: string; // "0" + fileUuid: string; // "90j3z7rmRphDPrdVgP9udFBaYar#oK0TWZIV" + formatType: string; // 1 + invalidState: number; // 0 + md5HexStr: string; // "e4d09c784d5a2abcb2f9980bdc7acfe6" + playState: number; // 0 + progress: number; // 0 + text: string; // "" + transferStatus: number; // 0 + translateStatus: number; // 0 + voiceChangeType: number; // 0 + voiceType: number; // 0 + waveAmplitudes: number[]; } export interface ArkElement { - bytesData: string; - linkInfo: null; - subElementType: null; + bytesData: string; + linkInfo: null; + subElementType: null; } export const IMAGE_HTTP_HOST = 'https://gchat.qpic.cn'; export const IMAGE_HTTP_HOST_NT = 'https://multimedia.nt.qq.com.cn'; export interface PicElement { - md5HexStr?: string; - fileSize: number | string;//number - picWidth: number; - picHeight: number; - fileName: string; - sourcePath: string; - original: boolean; - picType: PicType; - picSubType?: PicSubType; - fileUuid: string; - fileSubId: string; - thumbFileSize: number; - summary: string; - thumbPath: Map; - originImageMd5?: string; - originImageUrl?: string; // http url, 没有host,host是https://gchat.qpic.cn/, 带download参数的是https://multimedia.nt.qq.com.cn + md5HexStr?: string; + fileSize: number | string;//number + picWidth: number; + picHeight: number; + fileName: string; + sourcePath: string; + original: boolean; + picType: PicType; + picSubType?: PicSubType; + fileUuid: string; + fileSubId: string; + thumbFileSize: number; + summary: string; + thumbPath: Map; + originImageMd5?: string; + originImageUrl?: string; // http url, 没有host,host是https://gchat.qpic.cn/, 带download参数的是https://multimedia.nt.qq.com.cn } export enum GrayTipElementSubType { - INVITE_NEW_MEMBER = 12, - MEMBER_NEW_TITLE = 17 + INVITE_NEW_MEMBER = 12, + MEMBER_NEW_TITLE = 17 } export interface GrayTipElement { - subElementType: GrayTipElementSubType; - revokeElement: { - operatorRole: string; - operatorUid: string; - operatorNick: string; - operatorRemark: string; - operatorMemRemark?: string; - wording: string; // 自定义的撤回提示语 - } - aioOpGrayTipElement: TipAioOpGrayTipElement; - groupElement: TipGroupElement; - xmlElement: { - content: string; - templId: string; - }; - jsonGrayTipElement: { - busiId?: number; - jsonStr: string; - }; + subElementType: GrayTipElementSubType; + revokeElement: { + operatorRole: string; + operatorUid: string; + operatorNick: string; + operatorRemark: string; + operatorMemRemark?: string; + wording: string; // 自定义的撤回提示语 + }; + aioOpGrayTipElement: TipAioOpGrayTipElement; + groupElement: TipGroupElement; + xmlElement: { + content: string; + templId: string; + }; + jsonGrayTipElement: { + busiId?: number; + jsonStr: string; + }; } export enum FaceType { - normal = 1, // 小黄脸 - normal2 = 2, // 新小黄脸, 从faceIndex 222开始? - dice = 3 // 骰子 + normal = 1, // 小黄脸 + normal2 = 2, // 新小黄脸, 从faceIndex 222开始? + dice = 3 // 骰子 } + export enum FaceIndex { - dice = 358, - RPS = 359 // 石头剪刀布 + dice = 358, + RPS = 359 // 石头剪刀布 } + export interface FaceElement { - faceIndex: number; - faceType: FaceType; - faceText?: string; - packId?: string; - stickerId?: string; - sourceType?: number; - stickerType?: number; - resultId?: string; - surpriseId?: string; - randomType?: number; + faceIndex: number; + faceType: FaceType; + faceText?: string; + packId?: string; + stickerId?: string; + sourceType?: number; + stickerType?: number; + resultId?: string; + surpriseId?: string; + randomType?: number; } export interface MarketFaceElement { - emojiPackageId: number; - faceName: string; - emojiId: string; - key: string; + emojiPackageId: number; + faceName: string; + emojiId: string; + key: string; } export interface VideoElement { - filePath: string; - fileName: string; - videoMd5?: string; - thumbMd5?: string - fileTime?: number; // second - thumbSize?: number; // byte - fileFormat?: viedo_type; // 2表示mp4 参考下面条目 - fileSize?: string; // byte - thumbWidth?: number; - thumbHeight?: number; - busiType?: 0; // - subBusiType?: 0; // 未知 - thumbPath?: Map; - transferStatus?: 0; // 未知 - progress?: 0; // 下载进度? - invalidState?: 0; // 未知 - fileUuid?: string; // 可以用于下载链接? - fileSubId?: string; - fileBizId?: null; - originVideoMd5?: string; - import_rich_media_context?: null; - sourceVideoCodecFormat?: number; + filePath: string; + fileName: string; + videoMd5?: string; + thumbMd5?: string; + fileTime?: number; // second + thumbSize?: number; // byte + fileFormat?: viedo_type; // 2表示mp4 参考下面条目 + fileSize?: string; // byte + thumbWidth?: number; + thumbHeight?: number; + busiType?: 0; // + subBusiType?: 0; // 未知 + thumbPath?: Map; + transferStatus?: 0; // 未知 + progress?: 0; // 下载进度? + invalidState?: 0; // 未知 + fileUuid?: string; // 可以用于下载链接? + fileSubId?: string; + fileBizId?: null; + originVideoMd5?: string; + import_rich_media_context?: null; + sourceVideoCodecFormat?: number; } + // export enum busiType{ // public static final int CREATOR_SHARE_ADV_XWORLD = 21; // public static final int MINI_APP_MINI_GAME = 11; @@ -621,58 +663,60 @@ export interface VideoElement { // _kCateBusiTypeYearCluster = 8, // } export enum viedo_type { - VIDEO_FORMAT_AFS = 7, - VIDEO_FORMAT_AVI = 1, - VIDEO_FORMAT_MKV = 4, - VIDEO_FORMAT_MOD = 9, - VIDEO_FORMAT_MOV = 8, - VIDEO_FORMAT_MP4 = 2, - VIDEO_FORMAT_MTS = 11, - VIDEO_FORMAT_RM = 6, - VIDEO_FORMAT_RMVB = 5, - VIDEO_FORMAT_TS = 10, - VIDEO_FORMAT_WMV = 3, + VIDEO_FORMAT_AFS = 7, + VIDEO_FORMAT_AVI = 1, + VIDEO_FORMAT_MKV = 4, + VIDEO_FORMAT_MOD = 9, + VIDEO_FORMAT_MOV = 8, + VIDEO_FORMAT_MP4 = 2, + VIDEO_FORMAT_MTS = 11, + VIDEO_FORMAT_RM = 6, + VIDEO_FORMAT_RMVB = 5, + VIDEO_FORMAT_TS = 10, + VIDEO_FORMAT_WMV = 3, } + export interface MarkdownElement { - content: string; + content: string; } export interface InlineKeyboardElementRowButton { - id: string; - label: string; - visitedLabel: string; - style: 1; // 未知 - type: 2; // 未知 - clickLimit: 0; // 未知 - unsupportTips: string; - data: string; - atBotShowChannelList: boolean; - permissionType: number; - specifyRoleIds: []; - specifyTinyids: []; - isReply: false; - anchor: 0; - enter: false; - subscribeDataTemplateIds: [] + id: string; + label: string; + visitedLabel: string; + style: 1; // 未知 + type: 2; // 未知 + clickLimit: 0; // 未知 + unsupportTips: string; + data: string; + atBotShowChannelList: boolean; + permissionType: number; + specifyRoleIds: []; + specifyTinyids: []; + isReply: false; + anchor: 0; + enter: false; + subscribeDataTemplateIds: []; } export interface InlineKeyboardElement { - rows: [{ - buttons: InlineKeyboardElementRowButton[] - }]; + rows: [{ + buttons: InlineKeyboardElementRowButton[] + }]; } export interface TipAioOpGrayTipElement { // 这是什么提示来着? - operateType: number; - peerUid: string; - fromGrpCodeOfTmpChat: string; + operateType: number; + peerUid: string; + fromGrpCodeOfTmpChat: string; } export enum TipGroupElementType { - memberIncrease = 1, - kicked = 3, // 被移出群 - ban = 8 + memberIncrease = 1, + kicked = 3, // 被移出群 + ban = 8 } + // public final class MemberAddShowType { // public static final int KOTHERADD = 0; // public static final int KOTHERADDBYOTHERQRCODE = 2; @@ -685,102 +729,102 @@ export enum TipGroupElementType { // public static final int KYOUINVITEOTHER = 7; // } export interface TipGroupElement { - type: TipGroupElementType; // 1是表示有人加入群; 自己加入群也会收到这个 - role: 0; // 暂时不知 - groupName: string; // 暂时获取不到 - memberUid: string; - memberNick: string; - memberRemark: string; - adminUid: string; - adminNick: string; - adminRemark: string; - createGroup: null; - memberAdd?: { - showType: 1; - otherAdd: null; - otherAddByOtherQRCode: null; - otherAddByYourQRCode: null; - youAddByOtherQRCode: null; - otherInviteOther: null; - otherInviteYou: null; - youInviteOther: null - }; - shutUp?: { - curTime: string; - duration: string; // 禁言时间,秒 - admin: { - uid: string; - card: string; - name: string; - role: GroupMemberRole + type: TipGroupElementType; // 1是表示有人加入群; 自己加入群也会收到这个 + role: 0; // 暂时不知 + groupName: string; // 暂时获取不到 + memberUid: string; + memberNick: string; + memberRemark: string; + adminUid: string; + adminNick: string; + adminRemark: string; + createGroup: null; + memberAdd?: { + showType: 1; + otherAdd: null; + otherAddByOtherQRCode: null; + otherAddByYourQRCode: null; + youAddByOtherQRCode: null; + otherInviteOther: null; + otherInviteYou: null; + youInviteOther: null + }; + shutUp?: { + curTime: string; + duration: string; // 禁言时间,秒 + admin: { + uid: string; + card: string; + name: string; + role: GroupMemberRole + }; + member: { + uid: string + card: string; + name: string; + role: GroupMemberRole + } }; - member: { - uid: string - card: string; - name: string; - role: GroupMemberRole - } - } } export interface MultiForwardMsgElement { - xmlContent: string; // xml格式的消息内容 - resId: string; - fileName: string; + xmlContent: string; // xml格式的消息内容 + resId: string; + fileName: string; } export interface RawMessage { - parentMsgPeer: Peer; - parentMsgIdList:string[]; - id?: number;//扩展字段 用于处理OB11 ID - guildId: string; - msgRandom: string; + parentMsgPeer: Peer; + parentMsgIdList: string[]; + id?: number;//扩展字段 用于处理OB11 ID + guildId: string; + msgRandom: string; - msgId: string; + msgId: string; - // 时间戳,秒 - msgTime: string; + // 时间戳,秒 + msgTime: string; - msgSeq: string; - msgType: number; - subMsgType: number; - senderUid: string; - senderUin: string; // 发送者QQ号 - peerUid: string; // 群号 或者 QQ uid - peerUin: string; // 群号 或者 发送者QQ号 - sendNickName: string; - sendMemberName?: string; // 发送者群名片 - chatType: ChatType; - sendStatus?: number; // 消息状态,别人发的2是已撤回,自己发的2是已发送 - recallTime: string; // 撤回时间, "0"是没有撤回 - records: RawMessage[]; - elements: { - elementId: string; - elementType: ElementType; - replyElement: { - sourceMsgIdInRecords: string; - senderUid: string; // 原消息发送者QQ号 - sourceMsgIsIncPic: boolean; // 原消息是否有图片 - sourceMsgText: string; - replayMsgSeq: string; // 源消息的msgSeq,可以通过这个找到源消息的msgId - }; - textElement: { - atType: AtType; - atUid: string; // QQ号 - content: string; - atNtUid: string; // uid号 - }; - picElement: PicElement; - pttElement: PttElement; - arkElement: ArkElement; - grayTipElement: GrayTipElement; - faceElement: FaceElement; - videoElement: VideoElement; - fileElement: FileElement; - marketFaceElement: MarketFaceElement; - inlineKeyboardElement: InlineKeyboardElement; - markdownElement: MarkdownElement; - multiForwardMsgElement: MultiForwardMsgElement; - }[]; + msgSeq: string; + msgType: number; + subMsgType: number; + senderUid: string; + senderUin: string; // 发送者QQ号 + peerUid: string; // 群号 或者 QQ uid + peerUin: string; // 群号 或者 发送者QQ号 + sendNickName: string; + sendMemberName?: string; // 发送者群名片 + chatType: ChatType; + sendStatus?: number; // 消息状态,别人发的2是已撤回,自己发的2是已发送 + recallTime: string; // 撤回时间, "0"是没有撤回 + records: RawMessage[]; + elements: { + elementId: string; + elementType: ElementType; + replyElement: { + sourceMsgIdInRecords: string; + senderUid: string; // 原消息发送者QQ号 + sourceMsgIsIncPic: boolean; // 原消息是否有图片 + sourceMsgText: string; + replayMsgSeq: string; // 源消息的msgSeq,可以通过这个找到源消息的msgId + }; + textElement: { + atType: AtType; + atUid: string; // QQ号 + content: string; + atNtUid: string; // uid号 + }; + picElement: PicElement; + pttElement: PttElement; + arkElement: ArkElement; + grayTipElement: GrayTipElement; + faceElement: FaceElement; + videoElement: VideoElement; + fileElement: FileElement; + marketFaceElement: MarketFaceElement; + inlineKeyboardElement: InlineKeyboardElement; + markdownElement: MarkdownElement; + multiForwardMsgElement: MultiForwardMsgElement; + }[]; } diff --git a/src/core/entities/notify.ts b/src/core/entities/notify.ts index 6041eab7..9fb8c9ba 100644 --- a/src/core/entities/notify.ts +++ b/src/core/entities/notify.ts @@ -1,116 +1,120 @@ export enum GroupNotifyTypes { - INVITE_ME = 1, - INVITED_JOIN = 4, // 有人接受了邀请入群 - JOIN_REQUEST = 7, - ADMIN_SET = 8, - KICK_MEMBER = 9, - MEMBER_EXIT = 11, // 主动退出 - ADMIN_UNSET = 12, - ADMIN_UNSET_OTHER = 13, // 其他人取消管理员 + INVITE_ME = 1, + INVITED_JOIN = 4, // 有人接受了邀请入群 + JOIN_REQUEST = 7, + ADMIN_SET = 8, + KICK_MEMBER = 9, + MEMBER_EXIT = 11, // 主动退出 + ADMIN_UNSET = 12, + ADMIN_UNSET_OTHER = 13, // 其他人取消管理员 } export interface GroupNotifies { - doubt: boolean; - nextStartSeq: string; - notifies: GroupNotify[]; + doubt: boolean; + nextStartSeq: string; + notifies: GroupNotify[]; } export enum GroupNotifyStatus { - IGNORE = 0, - WAIT_HANDLE = 1, - APPROVE = 2, - REJECT = 3 + IGNORE = 0, + WAIT_HANDLE = 1, + APPROVE = 2, + REJECT = 3 } export interface GroupNotify { - time: number; // 自己添加的字段,时间戳,毫秒, 用于判断收到短时间内收到重复的notify - seq: string; // 唯一标识符,转成数字再除以1000应该就是时间戳? - type: GroupNotifyTypes; - status: GroupNotifyStatus; // 0是已忽略?,1是未处理,2是已同意 - group: { groupCode: string; groupName: string }; - user1: { uid: string; nickName: string }; // 被设置管理员的人 - user2: { uid: string; nickName: string }; // 操作者 - actionUser: { uid: string; nickName: string }; //未知 - actionTime: string; - invitationExt: { - srcType: number; // 0?未知 - groupCode: string; waitStatus: number - }; - postscript: string; // 加群用户填写的验证信息 - repeatSeqs: []; - warningTips: string + time: number; // 自己添加的字段,时间戳,毫秒, 用于判断收到短时间内收到重复的notify + seq: string; // 唯一标识符,转成数字再除以1000应该就是时间戳? + type: GroupNotifyTypes; + status: GroupNotifyStatus; // 0是已忽略?,1是未处理,2是已同意 + group: { groupCode: string; groupName: string }; + user1: { uid: string; nickName: string }; // 被设置管理员的人 + user2: { uid: string; nickName: string }; // 操作者 + actionUser: { uid: string; nickName: string }; //未知 + actionTime: string; + invitationExt: { + srcType: number; // 0?未知 + groupCode: string; waitStatus: number + }; + postscript: string; // 加群用户填写的验证信息 + repeatSeqs: []; + warningTips: string; } export enum GroupRequestOperateTypes { - approve = 1, - reject = 2 + approve = 1, + reject = 2 } + export enum BuddyReqType { - KMEINITIATOR, - KPEERINITIATOR, - KMEAGREED, - KMEAGREEDANDADDED, - KPEERAGREED, - KPEERAGREEDANDADDED, - KPEERREFUSED, - KMEREFUSED, - KMEIGNORED, - KMEAGREEANYONE, - KMESETQUESTION, - KMEAGREEANDADDFAILED, - KMSGINFO, - KMEINITIATORWAITPEERCONFIRM + KMEINITIATOR, + KPEERINITIATOR, + KMEAGREED, + KMEAGREEDANDADDED, + KPEERAGREED, + KPEERAGREEDANDADDED, + KPEERREFUSED, + KMEREFUSED, + KMEIGNORED, + KMEAGREEANYONE, + KMESETQUESTION, + KMEAGREEANDADDFAILED, + KMSGINFO, + KMEINITIATORWAITPEERCONFIRM } + export interface FriendRequest { - isInitiator?: boolean; - isDecide: boolean; - friendUid: string; - reqType: BuddyReqType, - reqTime: string; // 时间戳;秒 - extWords: string; // 申请人填写的验证消息 - isUnread: boolean; - friendNick: string; - sourceId: number; - groupCode: string + isInitiator?: boolean; + isDecide: boolean; + friendUid: string; + reqType: BuddyReqType, + reqTime: string; // 时间戳;秒 + extWords: string; // 申请人填写的验证消息 + isUnread: boolean; + friendNick: string; + sourceId: number; + groupCode: string } export interface FriendRequestNotify { - unreadNums: number; - buddyReqs: FriendRequest[]; + unreadNums: number; + buddyReqs: FriendRequest[]; } + export enum MemberExtSourceType { - DEFAULTTYPE = 0, - TITLETYPE = 1, - NEWGROUPTYPE = 2, + DEFAULTTYPE = 0, + TITLETYPE = 1, + NEWGROUPTYPE = 2, } + export interface GroupExtParam { - groupCode: string - seq: string - beginUin: string - dataTime: string - uinList: Array - uinNum: string - groupType: string - richCardNameVer: string - sourceType: MemberExtSourceType - memberExtFilter: { - memberLevelInfoUin: number - memberLevelInfoPoint: number - memberLevelInfoActiveDay: number - memberLevelInfoLevel: number - memberLevelInfoName: number - levelName: number - dataTime: number - userShowFlag: number - sysShowFlag: number - timeToUpdate: number - nickName: number - specialTitle: number - levelNameNew: number - userShowFlagNew: number - msgNeedField: number - cmdUinFlagExt3Grocery: number - memberIcon: number - memberInfoSeq: number - } -} \ No newline at end of file + groupCode: string; + seq: string; + beginUin: string; + dataTime: string; + uinList: Array; + uinNum: string; + groupType: string; + richCardNameVer: string; + sourceType: MemberExtSourceType; + memberExtFilter: { + memberLevelInfoUin: number + memberLevelInfoPoint: number + memberLevelInfoActiveDay: number + memberLevelInfoLevel: number + memberLevelInfoName: number + levelName: number + dataTime: number + userShowFlag: number + sysShowFlag: number + timeToUpdate: number + nickName: number + specialTitle: number + levelNameNew: number + userShowFlagNew: number + msgNeedField: number + cmdUinFlagExt3Grocery: number + memberIcon: number + memberInfoSeq: number + }; +} diff --git a/src/core/entities/sign.ts b/src/core/entities/sign.ts index 597d8691..ef2a40d2 100644 --- a/src/core/entities/sign.ts +++ b/src/core/entities/sign.ts @@ -11,6 +11,7 @@ export interface CustomMusicSignPostData { image?: string, singer?: string } + export interface MiniAppLuaJsonType { prompt: string, title: string, @@ -20,4 +21,4 @@ export interface MiniAppLuaJsonType { tagIcon: string, source: string, sourcelogo: string, - } \ No newline at end of file +} diff --git a/src/core/entities/system.ts b/src/core/entities/system.ts index 027bf96f..9466c4c2 100644 --- a/src/core/entities/system.ts +++ b/src/core/entities/system.ts @@ -1,15 +1,17 @@ -import { SelfInfo } from "./user"; +import { SelfInfo } from './user'; export interface LineDevice { - instanceId: number - clientType: number - devUid: string + instanceId: number; + clientType: number; + devUid: string; } + export interface OBLineDevice { app_id: string; device_name: string; device_kind: string; } + export interface CoreCache { selfInfo: SelfInfo, DeviceList: OBLineDevice[] diff --git a/src/core/entities/user.ts b/src/core/entities/user.ts index 0658ac6f..9b2c0091 100644 --- a/src/core/entities/user.ts +++ b/src/core/entities/user.ts @@ -3,12 +3,14 @@ export enum Sex { female = 2, unknown = 255, } + export interface BuddyCategoryType { categoryId: number; categroyName: string; categroyMbCount: number; buddyList: User[]; } + export interface CoreInfo { uid: string; uin: string; @@ -173,20 +175,23 @@ export interface SimpleInfo { otherFlags: any | null; intimate: any | null; } + export interface FriendV2 extends SimpleInfo { categoryId?: number; categroyName?: string; } + export interface SelfStatusInfo { - uid: string - status: number - extStatus: number - termType: number - netType: number - iconType: number - customStatus: any - setTime: string - } + uid: string; + status: number; + extStatus: number; + termType: number; + netType: number; + iconType: number; + customStatus: any; + setTime: string; +} + export interface UserDetailInfoListenerArg { uid: string; uin: string; @@ -194,6 +199,7 @@ export interface UserDetailInfoListenerArg { commonExt: CommonExt; photoWall: PhotoWall; } + export interface ModifyProfileParams { nick: string, longNick: string, @@ -212,11 +218,12 @@ export interface BuddyProfileLikeReq { start: number; limit: number; } + export interface QQLevel { crownNum: number; sunNum: number; moonNum: number; - starNum: number + starNum: number; } export interface User { @@ -228,7 +235,7 @@ export interface User { remark?: string; sex?: Sex; qqLevel?: QQLevel; - qid?: string + qid?: string; birthday_year?: number; birthday_month?: number; birthday_day?: number; @@ -239,7 +246,7 @@ export interface User { homeTown?: string; //"0-0-0"; makeFriendCareer?: number; pos?: string; - eMail?: string + eMail?: string; phoneNum?: string; college?: string; country?: string; @@ -281,12 +288,14 @@ export interface SelfInfo extends User { online?: boolean; } -export interface Friend extends User { } +export interface Friend extends User { +} export enum BizKey { KPRIVILEGEICON, KPHOTOWALL } + export interface UserDetailInfoByUinV2 { result: number, errMsg: string, @@ -298,6 +307,7 @@ export interface UserDetailInfoByUinV2 { photoWall: null } } + export interface UserDetailInfoByUin { result: number, errMsg: string, @@ -355,4 +365,4 @@ export interface UserDetailInfoByUin { pendantId: string, vipNameColorId: string } -} \ No newline at end of file +} diff --git a/src/core/entities/webapi.ts b/src/core/entities/webapi.ts index 94e1c8cb..a9112ecc 100644 --- a/src/core/entities/webapi.ts +++ b/src/core/entities/webapi.ts @@ -21,41 +21,44 @@ export enum WebHonorType { */ EMOTION = 'emotion' } + export interface WebApiGroupMember { - uin: number - role: number - g: number - join_time: number - last_speak_time: number + uin: number; + role: number; + g: number; + join_time: number; + last_speak_time: number; lv: { point: number level: number - } - card: string - tags: string - flag: number - nick: string - qage: number - rm: number + }; + card: string; + tags: string; + flag: number; + nick: string; + qage: number; + rm: number; } + export interface WebApiGroupMemberRet { - ec: number - errcode: number - em: string - cache: number - adm_num: number - levelname: any - mems: WebApiGroupMember[] - count: number - svr_time: number - max_count: number - search_count: number - extmode: number + ec: number; + errcode: number; + em: string; + cache: number; + adm_num: number; + levelname: any; + mems: WebApiGroupMember[]; + count: number; + svr_time: number; + max_count: number; + search_count: number; + extmode: number; } + export interface WebApiGroupNoticeFeed { - u: number//发送者 - fid: string//fid - pubt: number//时间 + u: number;//发送者 + fid: string;//fid + pubt: number;//时间 msg: { text: string text_face: string @@ -65,21 +68,22 @@ export interface WebApiGroupNoticeFeed { w: string, h: string }[] - } - type: number - fn: number - cn: number - vn: number + }; + type: number; + fn: number; + cn: number; + vn: number; settings: { is_show_edit_card: number remind_ts: number tip_window_type: number confirm_required: number - } - read_num: number - is_read: number - is_all_confirm: number + }; + read_num: number; + is_read: number; + is_all_confirm: number; } + export interface WebApiGroupNoticeRet { ec: number em: string @@ -100,26 +104,28 @@ export interface WebApiGroupNoticeRet { svrt: number ad: number } + export interface GroupEssenceMsg { - group_code: string - msg_seq: number - msg_random: number - sender_uin: string - sender_nick: string - sender_time: number - add_digest_uin: string - add_digest_nick: string - add_digest_time: number - msg_content: any[] - can_be_removed: true + group_code: string; + msg_seq: number; + msg_random: number; + sender_uin: string; + sender_nick: string; + sender_time: number; + add_digest_uin: string; + add_digest_nick: string; + add_digest_time: number; + msg_content: any[]; + can_be_removed: true; } + export interface GroupEssenceMsgRet { - retcode: number - retmsg: string + retcode: number; + retmsg: string; data: { msg_list: GroupEssenceMsg[] is_end: boolean group_role: number config_page_url: string - } + }; } diff --git a/src/core/external/face_config.json b/src/core/external/face_config.json index 84bb8fec..d065e29e 100644 --- a/src/core/external/face_config.json +++ b/src/core/external/face_config.json @@ -1,3665 +1,3665 @@ { - "sysface": [ - { - "QSid": "392", - "QDes": "/龙年快乐", - "IQLid": "392", - "AQLid": "392", - "EMCode": "10392", - "AniStickerType": 3, - "AniStickerPackId": "1", - "AniStickerId": "38" - }, - { - "QSid": "393", - "QDes": "/新年中龙", - "IQLid": "393", - "AQLid": "393", - "EMCode": "10393", - "QHide": "1", - "AniStickerType": 3, - "AniStickerPackId": "1", - "AniStickerId": "39" - }, - { - "QSid": "364", - "QDes": "/超级赞", - "IQLid": "364", - "AQLid": "364", - "EMCode": "10364", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "1", - "AniStickerPackId": "2", - "AniStickerPackName": "汪汪" - }, - { - "QSid": "366", - "QDes": "/芒狗", - "IQLid": "366", - "AQLid": "366", - "EMCode": "10366", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "2", - "AniStickerPackId": "2", - "AniStickerPackName": "汪汪" - }, - { - "QSid": "362", - "QDes": "/好兄弟", - "IQLid": "362", - "AQLid": "362", - "EMCode": "10362", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "3", - "AniStickerPackId": "2", - "AniStickerPackName": "汪汪" - }, - { - "QSid": "397", - "QDes": "/抛媚眼", - "IQLid": "397", - "AQLid": "397", - "EMCode": "10397", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "4", - "AniStickerPackId": "2", - "AniStickerPackName": "汪汪" - }, - { - "QSid": "396", - "QDes": "/狼狗", - "IQLid": "396", - "AQLid": "396", - "EMCode": "10396", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "5", - "AniStickerPackId": "2", - "AniStickerPackName": "汪汪" - }, - { - "QSid": "360", - "QDes": "/亲亲", - "IQLid": "360", - "AQLid": "360", - "EMCode": "10360", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "6", - "AniStickerPackId": "2", - "AniStickerPackName": "汪汪" - }, - { - "QSid": "361", - "QDes": "/狗狗笑哭", - "IQLid": "361", - "AQLid": "361", - "EMCode": "10361", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "7", - "AniStickerPackId": "2", - "AniStickerPackName": "汪汪" - }, - { - "QSid": "363", - "QDes": "/狗狗可怜", - "IQLid": "363", - "AQLid": "363", - "EMCode": "10363", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "8", - "AniStickerPackId": "2", - "AniStickerPackName": "汪汪" - }, - { - "QSid": "365", - "QDes": "/狗狗生气", - "IQLid": "365", - "AQLid": "365", - "EMCode": "10365", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "9", - "AniStickerPackId": "2", - "AniStickerPackName": "汪汪" - }, - { - "QSid": "367", - "QDes": "/狗狗疑问", - "IQLid": "367", - "AQLid": "367", - "EMCode": "10367", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "10", - "AniStickerPackId": "2", - "AniStickerPackName": "汪汪" - }, - { - "QSid": "399", - "QDes": "/tui", - "IQLid": "399", - "AQLid": "399", - "EMCode": "10399", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "1", - "AniStickerPackId": "6", - "AniStickerPackName": "噗噗星人" - }, - { - "QSid": "398", - "QDes": "/超级ok", - "IQLid": "398", - "AQLid": "398", - "EMCode": "10398", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "2", - "AniStickerPackId": "6", - "AniStickerPackName": "噗噗星人" - }, - { - "QSid": "373", - "QDes": "/忙", - "IQLid": "373", - "AQLid": "373", - "EMCode": "10373", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "3", - "AniStickerPackId": "6", - "AniStickerPackName": "噗噗星人" - }, - { - "QSid": "370", - "QDes": "/祝贺", - "IQLid": "370", - "AQLid": "370", - "EMCode": "10370", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "4", - "AniStickerPackId": "6", - "AniStickerPackName": "噗噗星人" - }, - { - "QSid": "375", - "QDes": "/超级鼓掌", - "IQLid": "375", - "AQLid": "375", - "EMCode": "10375", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "5", - "AniStickerPackId": "6", - "AniStickerPackName": "噗噗星人" - }, - { - "QSid": "368", - "QDes": "/奥特笑哭", - "IQLid": "368", - "AQLid": "368", - "EMCode": "10368", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "6", - "AniStickerPackId": "6", - "AniStickerPackName": "噗噗星人" - }, - { - "QSid": "369", - "QDes": "/彩虹", - "IQLid": "369", - "AQLid": "369", - "EMCode": "10369", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "7", - "AniStickerPackId": "6", - "AniStickerPackName": "噗噗星人" - }, - { - "QSid": "371", - "QDes": "/冒泡", - "IQLid": "371", - "AQLid": "371", - "EMCode": "10371", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "8", - "AniStickerPackId": "6", - "AniStickerPackName": "噗噗星人" - }, - { - "QSid": "372", - "QDes": "/气呼呼", - "IQLid": "372", - "AQLid": "372", - "EMCode": "10372", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "9", - "AniStickerPackId": "6", - "AniStickerPackName": "噗噗星人" - }, - { - "QSid": "374", - "QDes": "/波波流泪", - "IQLid": "374", - "AQLid": "374", - "EMCode": "10374", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "10", - "AniStickerPackId": "6", - "AniStickerPackName": "噗噗星人" - }, - { - "QSid": "382", - "QDes": "/emo", - "IQLid": "382", - "AQLid": "382", - "EMCode": "10382", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "1", - "AniStickerPackId": "5", - "AniStickerPackName": "企鹅" - }, - { - "QSid": "383", - "QDes": "/企鹅爱心", - "IQLid": "383", - "AQLid": "383", - "EMCode": "10383", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "2", - "AniStickerPackId": "5", - "AniStickerPackName": "企鹅" - }, - { - "QSid": "401", - "QDes": "/超级转圈", - "IQLid": "401", - "AQLid": "401", - "EMCode": "10401", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "3", - "AniStickerPackId": "5", - "AniStickerPackName": "企鹅" - }, - { - "QSid": "400", - "QDes": "/快乐", - "IQLid": "400", - "AQLid": "400", - "EMCode": "10400", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "4", - "AniStickerPackId": "5", - "AniStickerPackName": "企鹅" - }, - { - "QSid": "380", - "QDes": "/真棒", - "IQLid": "380", - "AQLid": "380", - "EMCode": "10380", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "5", - "AniStickerPackId": "5", - "AniStickerPackName": "企鹅" - }, - { - "QSid": "381", - "QDes": "/路过", - "IQLid": "381", - "AQLid": "381", - "EMCode": "10381", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "6", - "AniStickerPackId": "5", - "AniStickerPackName": "企鹅" - }, - { - "QSid": "379", - "QDes": "/企鹅流泪", - "IQLid": "379", - "AQLid": "379", - "EMCode": "10379", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "7", - "AniStickerPackId": "5", - "AniStickerPackName": "企鹅" - }, - { - "QSid": "376", - "QDes": "/跺脚", - "IQLid": "376", - "AQLid": "376", - "EMCode": "10376", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "8", - "AniStickerPackId": "5", - "AniStickerPackName": "企鹅" - }, - { - "QSid": "378", - "QDes": "/企鹅笑哭", - "IQLid": "378", - "AQLid": "378", - "EMCode": "10378", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "9", - "AniStickerPackId": "5", - "AniStickerPackName": "企鹅" - }, - { - "QSid": "377", - "QDes": "/嗨", - "IQLid": "377", - "AQLid": "377", - "EMCode": "10377", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "10", - "AniStickerPackId": "5", - "AniStickerPackName": "企鹅" - }, - { - "QSid": "403", - "QDes": "/出去玩", - "IQLid": "403", - "AQLid": "403", - "EMCode": "10403", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "1", - "AniStickerPackId": "4", - "AniStickerPackName": "QQ黄脸" - }, - { - "QSid": "402", - "QDes": "/别说话", - "IQLid": "402", - "AQLid": "402", - "EMCode": "10402", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "2", - "AniStickerPackId": "4", - "AniStickerPackName": "QQ黄脸" - }, - { - "QSid": "390", - "QDes": "/太头秃", - "IQLid": "390", - "AQLid": "390", - "EMCode": "10390", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "3", - "AniStickerPackId": "4", - "AniStickerPackName": "QQ黄脸" - }, - { - "QSid": "391", - "QDes": "/太沧桑", - "IQLid": "391", - "AQLid": "391", - "EMCode": "10391", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "4", - "AniStickerPackId": "4", - "AniStickerPackName": "QQ黄脸" - }, - { - "QSid": "388", - "QDes": "/太头疼", - "IQLid": "388", - "AQLid": "388", - "EMCode": "10388", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "5", - "AniStickerPackId": "4", - "AniStickerPackName": "QQ黄脸" - }, - { - "QSid": "389", - "QDes": "/太赞了", - "IQLid": "389", - "AQLid": "389", - "EMCode": "10389", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "6", - "AniStickerPackId": "4", - "AniStickerPackName": "QQ黄脸" - }, - { - "QSid": "386", - "QDes": "/呜呜呜", - "IQLid": "386", - "AQLid": "386", - "EMCode": "10386", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "7", - "AniStickerPackId": "4", - "AniStickerPackName": "QQ黄脸" - }, - { - "QSid": "385", - "QDes": "/太气了", - "IQLid": "385", - "AQLid": "385", - "EMCode": "10385", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "8", - "AniStickerPackId": "4", - "AniStickerPackName": "QQ黄脸" - }, - { - "QSid": "384", - "QDes": "/晚安", - "IQLid": "384", - "AQLid": "384", - "EMCode": "10384", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "9", - "AniStickerPackId": "4", - "AniStickerPackName": "QQ黄脸" - }, - { - "QSid": "387", - "QDes": "/太好笑", - "IQLid": "387", - "AQLid": "387", - "EMCode": "10387", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "10", - "AniStickerPackId": "4", - "AniStickerPackName": "QQ黄脸" - }, - { - "QSid": "413", - "QDes": "/摇起来", - "IQLid": "413", - "AQLid": "413", - "EMCode": "10413", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "1", - "AniStickerPackId": "3", - "AniStickerPackName": "喜花妮" - }, - { - "QSid": "405", - "QDes": "/好运来", - "IQLid": "405", - "AQLid": "405", - "EMCode": "10405", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "2", - "AniStickerPackId": "3", - "AniStickerPackName": "喜花妮" - }, - { - "QSid": "404", - "QDes": "/闪亮登场", - "IQLid": "404", - "AQLid": "404", - "EMCode": "10404", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "3", - "AniStickerPackId": "3", - "AniStickerPackName": "喜花妮" - }, - { - "QSid": "406", - "QDes": "/姐是女王", - "IQLid": "406", - "AQLid": "406", - "EMCode": "10406", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "4", - "AniStickerPackId": "3", - "AniStickerPackName": "喜花妮" - }, - { - "QSid": "410", - "QDes": "/么么哒", - "IQLid": "410", - "AQLid": "410", - "EMCode": "10410", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "5", - "AniStickerPackId": "3", - "AniStickerPackName": "喜花妮" - }, - { - "QSid": "411", - "QDes": "/一起嗨", - "IQLid": "411", - "AQLid": "411", - "EMCode": "10411", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "6", - "AniStickerPackId": "3", - "AniStickerPackName": "喜花妮" - }, - { - "QSid": "407", - "QDes": "/我听听", - "IQLid": "407", - "AQLid": "407", - "EMCode": "10407", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "7", - "AniStickerPackId": "3", - "AniStickerPackName": "喜花妮" - }, - { - "QSid": "408", - "QDes": "/臭美", - "IQLid": "408", - "AQLid": "408", - "EMCode": "10408", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "8", - "AniStickerPackId": "3", - "AniStickerPackName": "喜花妮" - }, - { - "QSid": "412", - "QDes": "/开心", - "IQLid": "412", - "AQLid": "412", - "EMCode": "10412", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "9", - "AniStickerPackId": "3", - "AniStickerPackName": "喜花妮" - }, - { - "QSid": "409", - "QDes": "/送你花花", - "IQLid": "409", - "AQLid": "409", - "EMCode": "10409", - "QHide": "1", - "AniStickerType": 1, - "AniStickerId": "10", - "AniStickerPackId": "3", - "AniStickerPackName": "喜花妮" - }, - { - "QSid": "394", - "QDes": "/新年大龙", - "IQLid": "394", - "AQLid": "394", - "EMCode": "10394", - "QHide": "1", - "AniStickerType": 3, - "AniStickerPackId": "1", - "AniStickerId": "40" - }, - { - "QSid": "14", - "QDes": "/微笑", - "IQLid": "23", - "AQLid": "23", - "EMCode": "100" - }, - { - "QSid": "1", - "QDes": "/撇嘴", - "IQLid": "40", - "AQLid": "40", - "EMCode": "101" - }, - { - "QSid": "2", - "QDes": "/色", - "IQLid": "19", - "AQLid": "19", - "EMCode": "102" - }, - { - "QSid": "3", - "QDes": "/发呆", - "IQLid": "43", - "AQLid": "43", - "EMCode": "103" - }, - { - "QSid": "4", - "QDes": "/得意", - "IQLid": "21", - "AQLid": "21", - "EMCode": "104" - }, - { - "QSid": "6", - "QDes": "/害羞", - "IQLid": "20", - "AQLid": "20", - "EMCode": "106" - }, - { - "QSid": "7", - "QDes": "/闭嘴", - "IQLid": "104", - "AQLid": "106", - "EMCode": "107" - }, - { - "QSid": "8", - "QDes": "/睡", - "IQLid": "35", - "AQLid": "35", - "EMCode": "108" - }, - { - "QSid": "9", - "QDes": "/大哭", - "IQLid": "10", - "AQLid": "10", - "EMCode": "109" - }, - { - "QSid": "5", - "QDes": "/流泪", - "IQLid": "9", - "AQLid": "9", - "EMCode": "105", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "16" - }, - { - "QSid": "10", - "QDes": "/尴尬", - "IQLid": "25", - "AQLid": "25", - "EMCode": "110" - }, - { - "QSid": "11", - "QDes": "/发怒", - "IQLid": "24", - "AQLid": "24", - "EMCode": "111" - }, - { - "QSid": "12", - "QDes": "/调皮", - "IQLid": "1", - "AQLid": "1", - "EMCode": "112" - }, - { - "QSid": "13", - "QDes": "/呲牙", - "IQLid": "0", - "AQLid": "0", - "EMCode": "113" - }, - { - "QSid": "0", - "QDes": "/惊讶", - "IQLid": "33", - "AQLid": "33", - "EMCode": "114" - }, - { - "QSid": "15", - "QDes": "/难过", - "IQLid": "32", - "AQLid": "32", - "EMCode": "115" - }, - { - "QSid": "16", - "QDes": "/酷", - "IQLid": "12", - "AQLid": "12", - "EMCode": "116" - }, - { - "QSid": "96", - "QDes": "/冷汗", - "IQLid": "27", - "AQLid": "27", - "EMCode": "117" - }, - { - "QSid": "18", - "QDes": "/抓狂", - "IQLid": "13", - "AQLid": "13", - "EMCode": "118" - }, - { - "QSid": "19", - "QDes": "/吐", - "IQLid": "22", - "AQLid": "22", - "EMCode": "119" - }, - { - "QSid": "20", - "QDes": "/偷笑", - "IQLid": "3", - "AQLid": "3", - "EMCode": "120" - }, - { - "QSid": "21", - "QDes": "/可爱", - "IQLid": "18", - "AQLid": "18", - "EMCode": "121" - }, - { - "QSid": "22", - "QDes": "/白眼", - "IQLid": "30", - "AQLid": "30", - "EMCode": "122" - }, - { - "QSid": "23", - "QDes": "/傲慢", - "IQLid": "31", - "AQLid": "31", - "EMCode": "123" - }, - { - "QSid": "24", - "QDes": "/饥饿", - "IQLid": "79", - "AQLid": "81", - "EMCode": "124" - }, - { - "QSid": "25", - "QDes": "/困", - "IQLid": "80", - "AQLid": "82", - "EMCode": "125" - }, - { - "QSid": "26", - "QDes": "/惊恐", - "IQLid": "26", - "AQLid": "26", - "EMCode": "126" - }, - { - "QSid": "27", - "QDes": "/流汗", - "IQLid": "2", - "AQLid": "2", - "EMCode": "127" - }, - { - "QSid": "28", - "QDes": "/憨笑", - "IQLid": "37", - "AQLid": "37", - "EMCode": "128" - }, - { - "QSid": "29", - "QDes": "/悠闲", - "IQLid": "50", - "AQLid": "50", - "EMCode": "129" - }, - { - "QSid": "30", - "QDes": "/奋斗", - "IQLid": "42", - "AQLid": "42", - "EMCode": "130" - }, - { - "QSid": "31", - "QDes": "/咒骂", - "IQLid": "81", - "AQLid": "83", - "EMCode": "131" - }, - { - "QSid": "32", - "QDes": "/疑问", - "IQLid": "34", - "AQLid": "34", - "EMCode": "132" - }, - { - "QSid": "33", - "QDes": "/嘘", - "IQLid": "11", - "AQLid": "11", - "EMCode": "133" - }, - { - "QSid": "34", - "QDes": "/晕", - "IQLid": "49", - "AQLid": "49", - "EMCode": "134" - }, - { - "QSid": "35", - "QDes": "/折磨", - "IQLid": "82", - "AQLid": "84", - "EMCode": "135" - }, - { - "QSid": "36", - "QDes": "/衰", - "IQLid": "39", - "AQLid": "39", - "EMCode": "136" - }, - { - "QSid": "37", - "QDes": "/骷髅", - "isStatic": "1", - "IQLid": "76", - "AQLid": "78", - "EMCode": "137" - }, - { - "QSid": "38", - "QDes": "/敲打", - "IQLid": "5", - "AQLid": "5", - "EMCode": "138" - }, - { - "QSid": "39", - "QDes": "/再见", - "IQLid": "4", - "AQLid": "4", - "EMCode": "139" - }, - { - "QSid": "97", - "QDes": "/擦汗", - "IQLid": "6", - "AQLid": "6", - "EMCode": "140" - }, - { - "QSid": "98", - "QDes": "/抠鼻", - "IQLid": "83", - "AQLid": "85", - "EMCode": "141" - }, - { - "QSid": "99", - "QDes": "/鼓掌", - "IQLid": "84", - "AQLid": "86", - "EMCode": "142" - }, - { - "QSid": "100", - "QDes": "/糗大了", - "IQLid": "85", - "AQLid": "87", - "EMCode": "143" - }, - { - "QSid": "101", - "QDes": "/坏笑", - "IQLid": "46", - "AQLid": "46", - "EMCode": "144" - }, - { - "QSid": "102", - "QDes": "/左哼哼", - "IQLid": "86", - "AQLid": "88", - "EMCode": "145" - }, - { - "QSid": "103", - "QDes": "/右哼哼", - "IQLid": "44", - "AQLid": "44", - "EMCode": "146" - }, - { - "QSid": "104", - "QDes": "/哈欠", - "IQLid": "87", - "AQLid": "89", - "EMCode": "147" - }, - { - "QSid": "105", - "QDes": "/鄙视", - "IQLid": "48", - "AQLid": "48", - "EMCode": "148" - }, - { - "QSid": "106", - "QDes": "/委屈", - "IQLid": "14", - "AQLid": "14", - "EMCode": "149" - }, - { - "QSid": "107", - "QDes": "/快哭了", - "IQLid": "88", - "AQLid": "90", - "EMCode": "150" - }, - { - "QSid": "108", - "QDes": "/阴险", - "IQLid": "41", - "AQLid": "41", - "EMCode": "151" - }, - { - "QSid": "305", - "QDes": "/右亲亲", - "IQLid": "305", - "AQLid": "305", - "EMCode": "10305" - }, - { - "QSid": "109", - "QDes": "/左亲亲", - "IQLid": "36", - "AQLid": "36", - "EMCode": "152" - }, - { - "QSid": "110", - "QDes": "/吓", - "IQLid": "89", - "AQLid": "91", - "EMCode": "153" - }, - { - "QSid": "111", - "QDes": "/可怜", - "IQLid": "51", - "AQLid": "51", - "EMCode": "154" - }, - { - "QSid": "172", - "QDes": "/眨眼睛", - "IQLid": "142", - "AQLid": "164", - "EMCode": "242" - }, - { - "QSid": "182", - "QDes": "/笑哭", - "IQLid": "152", - "AQLid": "174", - "EMCode": "252" - }, - { - "QSid": "179", - "QDes": "/doge", - "IQLid": "149", - "AQLid": "171", - "EMCode": "249" - }, - { - "QSid": "173", - "QDes": "/泪奔", - "IQLid": "143", - "AQLid": "165", - "EMCode": "243" - }, - { - "QSid": "174", - "QDes": "/无奈", - "IQLid": "144", - "AQLid": "166", - "EMCode": "244" - }, - { - "QSid": "212", - "QDes": "/托腮", - "IQLid": "182", - "AQLid": "161", - "EMCode": "282" - }, - { - "QSid": "175", - "QDes": "/卖萌", - "IQLid": "145", - "AQLid": "167", - "EMCode": "245" - }, - { - "QSid": "178", - "QDes": "/斜眼笑", - "IQLid": "148", - "AQLid": "170", - "EMCode": "248" - }, - { - "QSid": "177", - "QDes": "/喷血", - "IQLid": "147", - "AQLid": "169", - "EMCode": "247" - }, - { - "QSid": "176", - "QDes": "/小纠结", - "IQLid": "146", - "AQLid": "168", - "EMCode": "246" - }, - { - "QSid": "183", - "QDes": "/我最美", - "IQLid": "153", - "AQLid": "175", - "EMCode": "253" - }, - { - "QSid": "262", - "QDes": "/脑阔疼", - "IQLid": "262", - "AQLid": "262", - "EMCode": "10262" - }, - { - "QSid": "263", - "QDes": "/沧桑", - "IQLid": "263", - "AQLid": "263", - "EMCode": "10263" - }, - { - "QSid": "264", - "QDes": "/捂脸", - "IQLid": "264", - "AQLid": "264", - "EMCode": "10264" - }, - { - "QSid": "265", - "QDes": "/辣眼睛", - "IQLid": "265", - "AQLid": "265", - "EMCode": "10265" - }, - { - "QSid": "266", - "QDes": "/哦哟", - "IQLid": "266", - "AQLid": "266", - "EMCode": "10266" - }, - { - "QSid": "267", - "QDes": "/头秃", - "IQLid": "267", - "AQLid": "267", - "EMCode": "10267" - }, - { - "QSid": "268", - "QDes": "/问号脸", - "IQLid": "268", - "AQLid": "268", - "EMCode": "10268" - }, - { - "QSid": "269", - "QDes": "/暗中观察", - "IQLid": "269", - "AQLid": "269", - "EMCode": "10269" - }, - { - "QSid": "270", - "QDes": "/emm", - "IQLid": "270", - "AQLid": "270", - "EMCode": "10270" - }, - { - "QSid": "271", - "QDes": "/吃瓜", - "IQLid": "271", - "AQLid": "271", - "EMCode": "10271" - }, - { - "QSid": "272", - "QDes": "/呵呵哒", - "IQLid": "272", - "AQLid": "272", - "EMCode": "10272" - }, - { - "QSid": "277", - "QDes": "/汪汪", - "IQLid": "277", - "AQLid": "277", - "EMCode": "10277" - }, - { - "QSid": "307", - "QDes": "/喵喵", - "IQLid": "307", - "AQLid": "307", - "EMCode": "10307" - }, - { - "QSid": "306", - "QDes": "/牛气冲天", - "isStatic": "1", - "IQLid": "306", - "AQLid": "306", - "EMCode": "10306" - }, - { - "QSid": "281", - "QDes": "/无眼笑", - "IQLid": "281", - "AQLid": "281", - "EMCode": "10281" - }, - { - "QSid": "282", - "QDes": "/敬礼", - "IQLid": "282", - "AQLid": "282", - "EMCode": "10282" - }, - { - "QSid": "283", - "QDes": "/狂笑", - "IQLid": "283", - "AQLid": "283", - "EMCode": "10283" - }, - { - "QSid": "284", - "QDes": "/面无表情", - "IQLid": "284", - "AQLid": "284", - "EMCode": "10284" - }, - { - "QSid": "285", - "QDes": "/摸鱼", - "IQLid": "285", - "AQLid": "285", - "EMCode": "10285" - }, - { - "QSid": "293", - "QDes": "/摸锦鲤", - "IQLid": "293", - "AQLid": "293", - "EMCode": "10293" - }, - { - "QSid": "286", - "QDes": "/魔鬼笑", - "IQLid": "286", - "AQLid": "286", - "EMCode": "10286" - }, - { - "QSid": "287", - "QDes": "/哦", - "IQLid": "287", - "AQLid": "287", - "EMCode": "10287" - }, - { - "QSid": "289", - "QDes": "/睁眼", - "IQLid": "289", - "AQLid": "289", - "EMCode": "10289" - }, - { - "QSid": "294", - "QDes": "/期待", - "IQLid": "294", - "AQLid": "294", - "EMCode": "10294" - }, - { - "QSid": "297", - "QDes": "/拜谢", - "IQLid": "297", - "AQLid": "297", - "EMCode": "10297" - }, - { - "QSid": "298", - "QDes": "/元宝", - "IQLid": "298", - "AQLid": "298", - "EMCode": "10298" - }, - { - "QSid": "299", - "QDes": "/牛啊", - "IQLid": "299", - "AQLid": "299", - "EMCode": "10299" - }, - { - "QSid": "300", - "QDes": "/胖三斤", - "IQLid": "300", - "AQLid": "300", - "EMCode": "10300" - }, - { - "QSid": "323", - "QDes": "/嫌弃", - "IQLid": "323", - "AQLid": "323", - "EMCode": "10323" - }, - { - "QSid": "332", - "QDes": "/举牌牌", - "IQLid": "332", - "AQLid": "332", - "EMCode": "10332" - }, - { - "QSid": "336", - "QDes": "/豹富", - "IQLid": "336", - "AQLid": "336", - "EMCode": "10336" - }, - { - "QSid": "353", - "QDes": "/拜托", - "IQLid": "353", - "AQLid": "353", - "EMCode": "10353" - }, - { - "QSid": "355", - "QDes": "/耶", - "IQLid": "355", - "AQLid": "355", - "EMCode": "10355" - }, - { - "QSid": "356", - "QDes": "/666", - "IQLid": "356", - "AQLid": "356", - "EMCode": "10356" - }, - { - "QSid": "354", - "QDes": "/尊嘟假嘟", - "IQLid": "354", - "AQLid": "354", - "EMCode": "10354" - }, - { - "QSid": "352", - "QDes": "/咦", - "IQLid": "352", - "AQLid": "352", - "EMCode": "10352" - }, - { - "QSid": "357", - "QDes": "/裂开", - "IQLid": "357", - "AQLid": "357", - "EMCode": "10357" - }, - { - "QSid": "334", - "QDes": "/虎虎生威", - "IQLid": "334", - "AQLid": "334", - "EMCode": "10334" - }, - { - "QSid": "347", - "QDes": "/大展宏兔", - "IQLid": "347", - "AQLid": "347", - "EMCode": "10347" - }, - { - "QSid": "303", - "QDes": "/右拜年", - "IQLid": "303", - "AQLid": "303", - "EMCode": "10303" - }, - { - "QSid": "302", - "QDes": "/左拜年", - "IQLid": "302", - "AQLid": "302", - "EMCode": "10302" - }, - { - "QSid": "295", - "QDes": "/拿到红包", - "IQLid": "295", - "AQLid": "295", - "EMCode": "10295" - }, - { - "QSid": "311", - "QDes": "/打call", - "IQLid": "311", - "AQLid": "311", - "EMCode": "10311", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "1" - }, - { - "QSid": "312", - "QDes": "/变形", - "IQLid": "312", - "AQLid": "312", - "EMCode": "10312", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "2" - }, - { - "QSid": "314", - "QDes": "/仔细分析", - "IQLid": "314", - "AQLid": "314", - "EMCode": "10314", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "4" - }, - { - "QSid": "317", - "QDes": "/菜汪", - "IQLid": "317", - "AQLid": "317", - "EMCode": "10317", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "7" - }, - { - "QSid": "318", - "QDes": "/崇拜", - "IQLid": "318", - "AQLid": "318", - "EMCode": "10318", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "8" - }, - { - "QSid": "319", - "QDes": "/比心", - "IQLid": "319", - "AQLid": "319", - "EMCode": "10319", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "9" - }, - { - "QSid": "320", - "QDes": "/庆祝", - "IQLid": "320", - "AQLid": "320", - "EMCode": "10320", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "10" - }, - { - "QSid": "324", - "QDes": "/吃糖", - "IQLid": "324", - "AQLid": "324", - "EMCode": "10324", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "12" - }, - { - "QSid": "325", - "QDes": "/惊吓", - "IQLid": "325", - "AQLid": "325", - "EMCode": "10325", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "14" - }, - { - "QSid": "337", - "QDes": "/花朵脸", - "IQLid": "337", - "AQLid": "337", - "EMCode": "10337", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "22" - }, - { - "QSid": "338", - "QDes": "/我想开了", - "IQLid": "338", - "AQLid": "338", - "EMCode": "10338", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "20" - }, - { - "QSid": "339", - "QDes": "/舔屏", - "IQLid": "339", - "AQLid": "339", - "EMCode": "10339", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "21" - }, - { - "QSid": "341", - "QDes": "/打招呼", - "IQLid": "341", - "AQLid": "341", - "EMCode": "10341", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "24" - }, - { - "QSid": "342", - "QDes": "/酸Q", - "IQLid": "342", - "AQLid": "342", - "EMCode": "10342", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "26" - }, - { - "QSid": "343", - "QDes": "/我方了", - "IQLid": "343", - "AQLid": "343", - "EMCode": "10343", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "27" - }, - { - "QSid": "344", - "QDes": "/大怨种", - "IQLid": "344", - "AQLid": "344", - "EMCode": "10344", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "28" - }, - { - "QSid": "345", - "QDes": "/红包多多", - "IQLid": "345", - "AQLid": "345", - "EMCode": "10345", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "29" - }, - { - "QSid": "346", - "QDes": "/你真棒棒", - "IQLid": "346", - "AQLid": "346", - "EMCode": "10346", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "25" - }, - { - "QSid": "181", - "QDes": "/戳一戳", - "IQLid": "151", - "AQLid": "173", - "EMCode": "251", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "37" - }, - { - "QSid": "74", - "QDes": "/太阳", - "isStatic": "1", - "IQLid": "73", - "AQLid": "75", - "EMCode": "176", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "35" - }, - { - "QSid": "75", - "QDes": "/月亮", - "isStatic": "1", - "IQLid": "67", - "AQLid": "68", - "EMCode": "175", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "36" - }, - { - "QSid": "351", - "QDes": "/敲敲", - "IQLid": "351", - "AQLid": "351", - "EMCode": "10351", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "30" - }, - { - "QSid": "349", - "QDes": "/坚强", - "IQLid": "349", - "AQLid": "349", - "EMCode": "10349", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "32" - }, - { - "QSid": "350", - "QDes": "/贴贴", - "IQLid": "350", - "AQLid": "350", - "EMCode": "10350", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "31" - }, - { - "QSid": "395", - "QDes": "/略略略", - "IQLid": "395", - "AQLid": "395", - "EMCode": "10395", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "41" - }, - { - "QSid": "114", - "QDes": "/篮球", - "IQLid": "90", - "AQLid": "92", - "EMCode": "158", - "AniStickerType": 2, - "AniStickerPackId": "1", - "AniStickerId": "13" - }, - { - "QSid": "358", - "QDes": "/骰子", - "IQLid": "358", - "AQLid": "358", - "QHide": "1", - "EMCode": "10358", - "AniStickerType": 2, - "AniStickerPackId": "1", - "AniStickerId": "33" - }, - { - "QSid": "359", - "QDes": "/包剪锤", - "IQLid": "359", - "AQLid": "359", - "QHide": "1", - "EMCode": "10359", - "AniStickerType": 2, - "AniStickerPackId": "1", - "AniStickerId": "34" - }, - { - "QSid": "326", - "QDes": "/生气", - "IQLid": "326", - "AQLid": "326", - "EMCode": "10326", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "15" - }, - { - "QSid": "53", - "QDes": "/蛋糕", - "IQLid": "59", - "AQLid": "59", - "EMCode": "168", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "17" - }, - { - "QSid": "49", - "QDes": "/拥抱", - "IQLid": "45", - "AQLid": "45", - "EMCode": "178" - }, - { - "QSid": "66", - "QDes": "/爱心", - "IQLid": "28", - "AQLid": "28", - "EMCode": "166" - }, - { - "QSid": "63", - "QDes": "/玫瑰", - "IQLid": "8", - "AQLid": "8", - "EMCode": "163" - }, - { - "QSid": "64", - "QDes": "/凋谢", - "IQLid": "57", - "AQLid": "57", - "EMCode": "164" - }, - { - "QSid": "187", - "QDes": "/幽灵", - "IQLid": "157", - "AQLid": "179", - "EMCode": "257" - }, - { - "QSid": "146", - "QDes": "/爆筋", - "IQLid": "116", - "AQLid": "118", - "EMCode": "121011" - }, - { - "QSid": "116", - "QDes": "/示爱", - "IQLid": "29", - "AQLid": "29", - "EMCode": "165" - }, - { - "QSid": "67", - "QDes": "/心碎", - "IQLid": "72", - "AQLid": "74", - "EMCode": "167" - }, - { - "QSid": "60", - "QDes": "/咖啡", - "IQLid": "66", - "AQLid": "66", - "EMCode": "160" - }, - { - "QSid": "185", - "QDes": "/羊驼", - "IQLid": "155", - "AQLid": "177", - "EMCode": "255" - }, - { - "QSid": "137", - "QDes": "/鞭炮", - "isStatic": "1", - "IQLid": "107", - "AQLid": "109", - "EMCode": "121002", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "18" - }, - { - "QSid": "333", - "QDes": "/烟花", - "isStatic": "1", - "IQLid": "333", - "AQLid": "333", - "EMCode": "10333", - "AniStickerType": 1, - "AniStickerPackId": "1", - "AniStickerId": "19" - }, - { - "QSid": "76", - "QDes": "/赞", - "IQLid": "52", - "AQLid": "52", - "EMCode": "179" - }, - { - "QSid": "124", - "QDes": "/OK", - "IQLid": "64", - "AQLid": "64", - "EMCode": "189" - }, - { - "QSid": "118", - "QDes": "/抱拳", - "IQLid": "56", - "AQLid": "56", - "EMCode": "183" - }, - { - "QSid": "78", - "QDes": "/握手", - "IQLid": "54", - "AQLid": "54", - "EMCode": "181" - }, - { - "QSid": "119", - "QDes": "/勾引", - "IQLid": "63", - "AQLid": "63", - "EMCode": "184" - }, - { - "QSid": "79", - "QDes": "/胜利", - "IQLid": "55", - "AQLid": "55", - "EMCode": "182" - }, - { - "QSid": "120", - "QDes": "/拳头", - "IQLid": "71", - "AQLid": "73", - "EMCode": "185" - }, - { - "QSid": "121", - "QDes": "/差劲", - "IQLid": "70", - "AQLid": "72", - "EMCode": "186" - }, - { - "QSid": "77", - "QDes": "/踩", - "IQLid": "53", - "AQLid": "53", - "EMCode": "180" - }, - { - "QSid": "123", - "QDes": "/NO", - "IQLid": "92", - "AQLid": "94", - "EMCode": "188" - }, - { - "QSid": "201", - "QDes": "/点赞", - "IQLid": "171", - "AQLid": "150", - "EMCode": "271" - }, - { - "QSid": "273", - "QDes": "/我酸了", - "isStatic": "1", - "IQLid": "273", - "AQLid": "273", - "EMCode": "10273" - }, - { - "QSid": "46", - "QDes": "/猪头", - "isStatic": "1", - "IQLid": "7", - "AQLid": "7", - "EMCode": "162" - }, - { - "QSid": "112", - "QDes": "/菜刀", - "IQLid": "17", - "AQLid": "17", - "EMCode": "155" - }, - { - "QSid": "56", - "QDes": "/刀", - "IQLid": "68", - "AQLid": "70", - "EMCode": "171" - }, - { - "QSid": "169", - "QDes": "/手枪", - "isStatic": "1", - "IQLid": "139", - "AQLid": "141", - "EMCode": "121034" - }, - { - "QSid": "171", - "QDes": "/茶", - "IQLid": "141", - "AQLid": "163", - "EMCode": "241" - }, - { - "QSid": "59", - "QDes": "/便便", - "IQLid": "15", - "AQLid": "15", - "EMCode": "174" - }, - { - "QSid": "144", - "QDes": "/喝彩", - "isStatic": "1", - "IQLid": "114", - "AQLid": "116", - "EMCode": "121009" - }, - { - "QSid": "147", - "QDes": "/棒棒糖", - "isStatic": "1", - "IQLid": "117", - "AQLid": "119", - "EMCode": "121012" - }, - { - "QSid": "89", - "QDes": "/西瓜", - "isStatic": "1", - "IQLid": "60", - "AQLid": "60", - "EMCode": "156" - }, - { - "QSid": "148", - "QDes": "/喝奶", - "isStatic": "1", - "IQLid": "118", - "AQLid": "120", - "QHide": "1", - "EMCode": "121013" - }, - { - "QSid": "55", - "QDes": "/炸弹", - "isStatic": "1", - "IQLid": "16", - "AQLid": "16", - "QHide": "1", - "EMCode": "170" - }, - { - "QSid": "41", - "QDes": "/发抖", - "isStatic": "1", - "IQLid": "69", - "AQLid": "71", - "EMCode": "193" - }, - { - "QSid": "125", - "QDes": "/转圈", - "IQLid": "95", - "AQLid": "97", - "EMCode": "195" - }, - { - "QSid": "42", - "QDes": "/爱情", - "IQLid": "38", - "AQLid": "38", - "EMCode": "190" - }, - { - "QSid": "43", - "QDes": "/跳跳", - "IQLid": "93", - "AQLid": "95", - "EMCode": "192" - }, - { - "QSid": "86", - "QDes": "/怄火", - "IQLid": "94", - "AQLid": "96", - "EMCode": "194" - }, - { - "QSid": "129", - "QDes": "/挥手", - "IQLid": "77", - "AQLid": "79", - "EMCode": "199" - }, - { - "QSid": "226", - "QDes": "/拍桌", - "IQLid": "196", - "isCMEmoji": "1", - "AQLid": "198", - "QHide": "1", - "EMCode": "297" - }, - { - "QSid": "85", - "QDes": "/飞吻", - "isStatic": "1", - "IQLid": "47", - "AQLid": "47", - "EMCode": "191" - }, - { - "QSid": "215", - "QDes": "/糊脸", - "IQLid": "185", - "isCMEmoji": "1", - "AQLid": "187", - "QHide": "1", - "EMCode": "285" - }, - { - "QSid": "214", - "QDes": "/啵啵", - "IQLid": "184", - "isCMEmoji": "1", - "AQLid": "186", - "QHide": "1", - "EMCode": "284" - }, - { - "QSid": "222", - "QDes": "/抱抱", - "IQLid": "192", - "isCMEmoji": "1", - "AQLid": "194", - "QHide": "1", - "EMCode": "292" - }, - { - "QSid": "203", - "QDes": "/托脸", - "IQLid": "173", - "AQLid": "152", - "QHide": "1", - "EMCode": "273" - }, - { - "QSid": "235", - "QDes": "/颤抖", - "IQLid": "205", - "isCMEmoji": "1", - "AQLid": "207", - "QHide": "1", - "EMCode": "305" - }, - { - "QSid": "241", - "QDes": "/生日快乐", - "IQLid": "211", - "isCMEmoji": "1", - "AQLid": "213", - "QHide": "1", - "EMCode": "311" - }, - { - "QSid": "237", - "QDes": "/偷看", - "IQLid": "207", - "isCMEmoji": "1", - "AQLid": "209", - "QHide": "1", - "EMCode": "307" - }, - { - "QSid": "218", - "QDes": "/舔一舔", - "IQLid": "188", - "isCMEmoji": "1", - "AQLid": "190", - "QHide": "1", - "EMCode": "288" - }, - { - "QSid": "233", - "QDes": "/掐一掐", - "IQLid": "203", - "isCMEmoji": "1", - "AQLid": "205", - "QHide": "1", - "EMCode": "303" - }, - { - "QSid": "232", - "QDes": "/佛系", - "IQLid": "202", - "isCMEmoji": "1", - "AQLid": "204", - "QHide": "1", - "EMCode": "302" - }, - { - "QSid": "238", - "QDes": "/扇脸", - "IQLid": "208", - "isCMEmoji": "1", - "AQLid": "210", - "QHide": "1", - "EMCode": "308" - }, - { - "QSid": "217", - "QDes": "/扯一扯", - "IQLid": "187", - "isCMEmoji": "1", - "AQLid": "189", - "QHide": "1", - "EMCode": "287" - }, - { - "QSid": "225", - "QDes": "/撩一撩", - "IQLid": "195", - "isCMEmoji": "1", - "AQLid": "197", - "QHide": "1", - "EMCode": "296" - }, - { - "QSid": "230", - "QDes": "/嘲讽", - "IQLid": "200", - "isCMEmoji": "1", - "AQLid": "202", - "QHide": "1", - "EMCode": "300" - }, - { - "QSid": "194", - "QDes": "/不开心", - "IQLid": "164", - "AQLid": "143", - "QHide": "1", - "EMCode": "264" - }, - { - "QSid": "210", - "QDes": "/飙泪", - "IQLid": "180", - "AQLid": "159", - "QHide": "1", - "EMCode": "280" - }, - { - "QSid": "193", - "QDes": "/大笑", - "IQLid": "163", - "AQLid": "185", - "QHide": "1", - "EMCode": "263" - }, - { - "QSid": "204", - "QDes": "/吃", - "IQLid": "174", - "AQLid": "153", - "QHide": "1", - "EMCode": "274" - }, - { - "QSid": "200", - "QDes": "/求求", - "IQLid": "170", - "AQLid": "149", - "QHide": "1", - "EMCode": "270" - }, - { - "QSid": "290", - "QDes": "/敲开心", - "IQLid": "290", - "isCMEmoji": "1", - "AQLid": "290", - "QHide": "1", - "EMCode": "20240" - }, - { - "QSid": "224", - "QDes": "/开枪", - "IQLid": "194", - "isCMEmoji": "1", - "AQLid": "196", - "QHide": "1", - "EMCode": "295" - }, - { - "QSid": "229", - "QDes": "/干杯", - "IQLid": "199", - "isCMEmoji": "1", - "AQLid": "201", - "QHide": "1", - "EMCode": "299" - }, - { - "QSid": "221", - "QDes": "/顶呱呱", - "IQLid": "191", - "isCMEmoji": "1", - "AQLid": "193", - "QHide": "1", - "EMCode": "291" - }, - { - "QSid": "219", - "QDes": "/蹭一蹭", - "IQLid": "189", - "isCMEmoji": "1", - "AQLid": "191", - "QHide": "1", - "EMCode": "289" - }, - { - "QSid": "227", - "QDes": "/拍手", - "IQLid": "197", - "isCMEmoji": "1", - "AQLid": "199", - "QHide": "1", - "EMCode": "294" - }, - { - "QSid": "216", - "QDes": "/拍头", - "IQLid": "186", - "isCMEmoji": "1", - "AQLid": "188", - "QHide": "1", - "EMCode": "286" - }, - { - "QSid": "231", - "QDes": "/哼", - "IQLid": "201", - "isCMEmoji": "1", - "AQLid": "203", - "QHide": "1", - "EMCode": "301" - }, - { - "QSid": "244", - "QDes": "/扔狗", - "IQLid": "214", - "isCMEmoji": "1", - "AQLid": "216", - "QHide": "1", - "EMCode": "312" - }, - { - "QSid": "223", - "QDes": "/暴击", - "IQLid": "193", - "isCMEmoji": "1", - "AQLid": "195", - "QHide": "1", - "EMCode": "293" - }, - { - "QSid": "243", - "QDes": "/甩头", - "IQLid": "213", - "isCMEmoji": "1", - "AQLid": "215", - "QHide": "1", - "EMCode": "313" - }, - { - "QSid": "211", - "QDes": "/我不看", - "IQLid": "181", - "AQLid": "160", - "QHide": "1", - "EMCode": "281" - }, - { - "QSid": "292", - "QDes": "/让我康康", - "IQLid": "292", - "isCMEmoji": "1", - "AQLid": "292", - "QHide": "1", - "EMCode": "20242" - }, - { - "QSid": "240", - "QDes": "/喷脸", - "IQLid": "210", - "isCMEmoji": "1", - "AQLid": "212", - "QHide": "1", - "EMCode": "310" - }, - { - "QSid": "180", - "QDes": "/惊喜", - "IQLid": "150", - "AQLid": "172", - "QHide": "1", - "EMCode": "250" - }, - { - "QSid": "122", - "QDes": "/爱你", - "IQLid": "65", - "AQLid": "65", - "QHide": "1", - "EMCode": "187" - }, - { - "QSid": "202", - "QDes": "/无聊", - "IQLid": "172", - "AQLid": "151", - "QHide": "1", - "EMCode": "272" - }, - { - "QSid": "278", - "QDes": "/汗", - "IQLid": "278", - "isCMEmoji": "1", - "AQLid": "278", - "QHide": "1", - "EMCode": "20237" - }, - { - "QSid": "301", - "QDes": "/好闪", - "IQLid": "301", - "AQLid": "301", - "QHide": "1", - "EMCode": "10301" - }, - { - "QSid": "288", - "QDes": "/请", - "IQLid": "288", - "AQLid": "288", - "QHide": "1", - "EMCode": "10288" - }, - { - "QSid": "322", - "QDes": "/拒绝", - "IQLid": "322", - "AQLid": "322", - "QHide": "1", - "EMCode": "10322" - }, - { - "QSid": "198", - "QDes": "/呃", - "IQLid": "168", - "AQLid": "147", - "QHide": "1", - "EMCode": "268" - }, - { - "QSid": "348", - "QDes": "/福萝卜", - "IQLid": "348", - "AQLid": "348", - "QHide": "1", - "EMCode": "10348" - }, - { - "QSid": "206", - "QDes": "/害怕", - "IQLid": "176", - "AQLid": "155", - "QHide": "1", - "EMCode": "276" - }, - { - "QSid": "239", - "QDes": "/原谅", - "IQLid": "209", - "isCMEmoji": "1", - "AQLid": "211", - "QHide": "1", - "EMCode": "309" - } - ], - "emoji": [ - { - "QSid": "😊", - "QCid": "128522", - "AQLid": "0", - "QDes": "/嘿嘿", - "EMCode": "400832" - }, - { - "QSid": "😌", - "QCid": "128524", - "AQLid": "1", - "QDes": "/羞涩", - "EMCode": "400834" - }, - { - "QSid": "😚", - "QCid": "128538", - "AQLid": "2", - "QDes": "/亲亲", - "EMCode": "400848" - }, - { - "QSid": "😓", - "QCid": "128531", - "AQLid": "3", - "QDes": "/汗", - "EMCode": "400841" - }, - { - "QSid": "😰", - "QCid": "128560", - "AQLid": "4", - "QDes": "/紧张", - "EMCode": "400870" - }, - { - "QSid": "😝", - "QCid": "128541", - "AQLid": "5", - "QDes": "/吐舌", - "EMCode": "400851" - }, - { - "QSid": "😁", - "QCid": "128513", - "AQLid": "6", - "QDes": "/呲牙", - "EMCode": "400823" - }, - { - "QSid": "😜", - "QCid": "128540", - "AQLid": "7", - "QDes": "/淘气", - "EMCode": "400850" - }, - { - "QSid": "☺", - "QCid": "9786", - "AQLid": "8", - "QDes": "/可爱", - "EMCode": "401181" - }, - { - "QSid": "😉", - "QCid": "128521", - "AQLid": "9", - "QDes": "/媚眼", - "QHide": "1", - "EMCode": "400831" - }, - { - "QSid": "😍", - "QCid": "128525", - "AQLid": "10", - "QDes": "/花痴", - "EMCode": "400835" - }, - { - "QSid": "😔", - "QCid": "128532", - "AQLid": "11", - "QDes": "/失落", - "EMCode": "400842" - }, - { - "QSid": "😄", - "QCid": "128516", - "AQLid": "12", - "QDes": "/高兴", - "EMCode": "400826" - }, - { - "QSid": "😏", - "QCid": "128527", - "AQLid": "13", - "QDes": "/哼哼", - "EMCode": "400837" - }, - { - "QSid": "😒", - "QCid": "128530", - "AQLid": "14", - "QDes": "/不屑", - "EMCode": "400840" - }, - { - "QSid": "😳", - "QCid": "128563", - "AQLid": "15", - "QDes": "/瞪眼", - "EMCode": "400873" - }, - { - "QSid": "😘", - "QCid": "128536", - "AQLid": "16", - "QDes": "/飞吻", - "EMCode": "400846" - }, - { - "QSid": "😭", - "QCid": "128557", - "AQLid": "17", - "QDes": "/大哭", - "EMCode": "400867" - }, - { - "QSid": "😱", - "QCid": "128561", - "AQLid": "18", - "QDes": "/害怕", - "EMCode": "400871" - }, - { - "QSid": "😂", - "QCid": "128514", - "AQLid": "19", - "QDes": "/激动", - "EMCode": "400824" - }, - { - "QSid": "💪", - "QCid": "128170", - "AQLid": "20", - "QDes": "/肌肉", - "EMCode": "400644" - }, - { - "QSid": "👊", - "QCid": "128074", - "AQLid": "21", - "QDes": "/拳头", - "EMCode": "400390" - }, - { - "QSid": "👍", - "QCid": "128077", - "AQLid": "22", - "QDes": "/厉害", - "EMCode": "400408" - }, - { - "QSid": "☝", - "QCid": "9757", - "AQLid": "23", - "QDes": "/向上", - "QHide": "1", - "EMCode": "401203" - }, - { - "QSid": "👏", - "QCid": "128079", - "AQLid": "24", - "QDes": "/鼓掌", - "EMCode": "400420" - }, - { - "QSid": "✌", - "QCid": "9996", - "AQLid": "25", - "QDes": "/胜利", - "QHide": "1", - "EMCode": "401210" - }, - { - "QSid": "👎", - "QCid": "128078", - "AQLid": "26", - "QDes": "/鄙视", - "EMCode": "400414" - }, - { - "QSid": "🙏", - "QCid": "128591", - "AQLid": "27", - "QDes": "/合十", - "EMCode": "400396" - }, - { - "QSid": "👌", - "QCid": "128076", - "AQLid": "28", - "QDes": "/好的", - "EMCode": "400402" - }, - { - "QSid": "👈", - "QCid": "128072", - "AQLid": "29", - "QDes": "/向左", - "QHide": "1", - "EMCode": "400378" - }, - { - "QSid": "👉", - "QCid": "128073", - "AQLid": "30", - "QDes": "/向右", - "QHide": "1", - "EMCode": "400384" - }, - { - "QSid": "👆", - "QCid": "128070", - "AQLid": "31", - "QDes": "/向上", - "EMCode": "400366" - }, - { - "QSid": "👇", - "QCid": "128071", - "AQLid": "32", - "QDes": "/向下", - "QHide": "1", - "EMCode": "400372" - }, - { - "QSid": "👀", - "QCid": "128064", - "AQLid": "33", - "QDes": "/眼睛", - "EMCode": "400351" - }, - { - "QSid": "👃", - "QCid": "128067", - "AQLid": "34", - "QDes": "/鼻子", - "QHide": "1", - "EMCode": "400358" - }, - { - "QSid": "👄", - "QCid": "128068", - "AQLid": "35", - "QDes": "/嘴唇", - "QHide": "1", - "EMCode": "400364" - }, - { - "QSid": "👂", - "QCid": "128066", - "AQLid": "36", - "QDes": "/耳朵", - "QHide": "1", - "EMCode": "400352" - }, - { - "QSid": "🍚", - "QCid": "127834", - "AQLid": "37", - "QDes": "/米饭", - "QHide": "1", - "EMCode": "400149" - }, - { - "QSid": "🍝", - "QCid": "127837", - "AQLid": "38", - "QDes": "/意面", - "QHide": "1", - "EMCode": "400152" - }, - { - "QSid": "🍜", - "QCid": "127836", - "AQLid": "39", - "QDes": "/拉面", - "EMCode": "400151" - }, - { - "QSid": "🍙", - "QCid": "127833", - "AQLid": "40", - "QDes": "/饭团", - "QHide": "1", - "EMCode": "400148" - }, - { - "QSid": "🍧", - "QCid": "127847", - "AQLid": "41", - "QDes": "/刨冰", - "EMCode": "400162" - }, - { - "QSid": "🍣", - "QCid": "127843", - "AQLid": "42", - "QDes": "/寿司", - "QHide": "1", - "EMCode": "400158" - }, - { - "QSid": "🎂", - "QCid": "127874", - "AQLid": "43", - "QDes": "/蛋糕", - "QHide": "1", - "EMCode": "400186" - }, - { - "QSid": "🍞", - "QCid": "127838", - "AQLid": "44", - "QDes": "/面包", - "EMCode": "400153" - }, - { - "QSid": "🍔", - "QCid": "127828", - "AQLid": "45", - "QDes": "/汉堡", - "QHide": "1", - "EMCode": "400143" - }, - { - "QSid": "🍳", - "QCid": "127859", - "AQLid": "46", - "QDes": "/煎蛋", - "QHide": "1", - "EMCode": "400174" - }, - { - "QSid": "🍟", - "QCid": "127839", - "AQLid": "47", - "QDes": "/薯条", - "QHide": "1", - "EMCode": "400154" - }, - { - "QSid": "🍺", - "QCid": "127866", - "AQLid": "48", - "QDes": "/啤酒", - "EMCode": "400181" - }, - { - "QSid": "🍻", - "QCid": "127867", - "AQLid": "49", - "QDes": "/干杯", - "EMCode": "400182" - }, - { - "QSid": "🍸", - "QCid": "127864", - "AQLid": "50", - "QDes": "/高脚杯", - "QHide": "1", - "EMCode": "400179" - }, - { - "QSid": "☕", - "QCid": "9749", - "AQLid": "51", - "QDes": "/咖啡", - "EMCode": "401262" - }, - { - "QSid": "🍎", - "QCid": "127822", - "AQLid": "52", - "QDes": "/苹果", - "EMCode": "400137" - }, - { - "QSid": "🍊", - "QCid": "127818", - "AQLid": "53", - "QDes": "/橙子", - "QHide": "1", - "EMCode": "400133" - }, - { - "QSid": "🍓", - "QCid": "127827", - "AQLid": "54", - "QDes": "/草莓", - "EMCode": "400142" - }, - { - "QSid": "🍉", - "QCid": "127817", - "AQLid": "55", - "QDes": "/西瓜", - "EMCode": "400132" - }, - { - "QSid": "💊", - "QCid": "128138", - "AQLid": "56", - "QDes": "/药丸", - "QHide": "1", - "EMCode": "400612" - }, - { - "QSid": "🚬", - "QCid": "128684", - "AQLid": "57", - "QDes": "/吸烟", - "EMCode": "400987" - }, - { - "QSid": "🎄", - "QCid": "127876", - "AQLid": "58", - "QDes": "/圣诞树", - "QHide": "1", - "EMCode": "400188" - }, - { - "QSid": "🌹", - "QCid": "127801", - "AQLid": "59", - "QDes": "/玫瑰", - "EMCode": "400116" - }, - { - "QSid": "🎉", - "QCid": "127881", - "AQLid": "60", - "QDes": "/庆祝", - "EMCode": "400198" - }, - { - "QSid": "🌴", - "QCid": "127796", - "AQLid": "61", - "QDes": "/椰子树", - "QHide": "1", - "EMCode": "400112" - }, - { - "QSid": "💝", - "QCid": "128157", - "AQLid": "62", - "QDes": "/礼物", - "EMCode": "400631" - }, - { - "QSid": "🎀", - "QCid": "127872", - "AQLid": "63", - "QDes": "/蝴蝶结", - "QHide": "1", - "EMCode": "400184" - }, - { - "QSid": "🎈", - "QCid": "127880", - "AQLid": "64", - "QDes": "/气球", - "QHide": "1", - "EMCode": "400197" - }, - { - "QSid": "🐚", - "QCid": "128026", - "AQLid": "65", - "QDes": "/海螺", - "QHide": "1", - "EMCode": "400314" - }, - { - "QSid": "💍", - "QCid": "128141", - "AQLid": "66", - "QDes": "/戒指", - "QHide": "1", - "EMCode": "400615" - }, - { - "QSid": "💣", - "QCid": "128163", - "AQLid": "67", - "QDes": "/炸弹", - "EMCode": "400637" - }, - { - "QSid": "👑", - "QCid": "128081", - "AQLid": "68", - "QDes": "/皇冠", - "QHide": "1", - "EMCode": "400432" - }, - { - "QSid": "🔔", - "QCid": "128276", - "AQLid": "69", - "QDes": "/铃铛", - "QHide": "1", - "EMCode": "400751" - }, - { - "QSid": "⭐", - "QCid": "11088", - "AQLid": "70", - "QDes": "/星星", - "QHide": "1", - "EMCode": "401686" - }, - { - "QSid": "✨", - "QCid": "10024", - "AQLid": "71", - "QDes": "/闪光", - "EMCode": "401137" - }, - { - "QSid": "💨", - "QCid": "128168", - "AQLid": "72", - "QDes": "/吹气", - "EMCode": "400642" - }, - { - "QSid": "💦", - "QCid": "128166", - "AQLid": "73", - "QDes": "/水", - "EMCode": "400640" - }, - { - "QSid": "🔥", - "QCid": "128293", - "AQLid": "74", - "QDes": "/火", - "EMCode": "400768" - }, - { - "QSid": "🏆", - "QCid": "127942", - "AQLid": "75", - "QDes": "/奖杯", - "QHide": "1", - "EMCode": "400256" - }, - { - "QSid": "💰", - "QCid": "128176", - "AQLid": "76", - "QDes": "/钱", - "QHide": "1", - "EMCode": "400655" - }, - { - "QSid": "💤", - "QCid": "128164", - "AQLid": "77", - "QDes": "/睡觉", - "EMCode": "400638" - }, - { - "QSid": "⚡", - "QCid": "9889", - "AQLid": "78", - "QDes": "/闪电", - "QHide": "1", - "EMCode": "401685" - }, - { - "QSid": "👣", - "QCid": "128099", - "AQLid": "79", - "QDes": "/脚印", - "QHide": "1", - "EMCode": "400450" - }, - { - "QSid": "💩", - "QCid": "128169", - "AQLid": "80", - "QDes": "/便便", - "EMCode": "400643" - }, - { - "QSid": "💉", - "QCid": "128137", - "AQLid": "81", - "QDes": "/打针", - "EMCode": "400611" - }, - { - "QSid": "♨", - "QCid": "9832", - "AQLid": "82", - "QDes": "/热", - "QHide": "1", - "EMCode": "401287" - }, - { - "QSid": "📫", - "QCid": "128235", - "AQLid": "83", - "QDes": "/邮箱", - "EMCode": "400714" - }, - { - "QSid": "🔑", - "QCid": "128273", - "AQLid": "84", - "QDes": "/钥匙", - "QHide": "1", - "EMCode": "400748" - }, - { - "QSid": "🔒", - "QCid": "128274", - "AQLid": "85", - "QDes": "/锁", - "QHide": "1", - "EMCode": "400749" - }, - { - "QSid": "✈", - "QCid": "9992", - "AQLid": "86", - "QDes": "/飞机", - "QHide": "1", - "EMCode": "401298" - }, - { - "QSid": "🚄", - "QCid": "128644", - "AQLid": "87", - "QDes": "/列车", - "QHide": "1", - "EMCode": "400942" - }, - { - "QSid": "🚗", - "QCid": "128663", - "AQLid": "88", - "QDes": "/汽车", - "QHide": "1", - "EMCode": "400961" - }, - { - "QSid": "🚤", - "QCid": "128676", - "AQLid": "89", - "QDes": "/快艇", - "QHide": "1", - "EMCode": "400979" - }, - { - "QSid": "🚲", - "QCid": "128690", - "AQLid": "90", - "QDes": "/自行车", - "QHide": "1", - "EMCode": "400993" - }, - { - "QSid": "🐎", - "QCid": "128014", - "AQLid": "91", - "QDes": "/骑马", - "EMCode": "400302" - }, - { - "QSid": "🚀", - "QCid": "128640", - "AQLid": "92", - "QDes": "/火箭", - "QHide": "1", - "EMCode": "400938" - }, - { - "QSid": "🚌", - "QCid": "128652", - "AQLid": "93", - "QDes": "/公交", - "QHide": "1", - "EMCode": "400950" - }, - { - "QSid": "⛵", - "QCid": "9973", - "AQLid": "94", - "QDes": "/船", - "QHide": "1", - "EMCode": "401294" - }, - { - "QSid": "👩", - "QCid": "128105", - "AQLid": "95", - "QDes": "/妈妈", - "QHide": "1", - "EMCode": "400482" - }, - { - "QSid": "👨", - "QCid": "128104", - "AQLid": "96", - "QDes": "/爸爸", - "QHide": "1", - "EMCode": "400465" - }, - { - "QSid": "👧", - "QCid": "128103", - "AQLid": "97", - "QDes": "/女孩", - "EMCode": "400459" - }, - { - "QSid": "👦", - "QCid": "128102", - "AQLid": "98", - "QDes": "/男孩", - "EMCode": "400453" - }, - { - "QSid": "🐵", - "QCid": "128053", - "AQLid": "99", - "QDes": "/猴", - "EMCode": "400341" - }, - { - "QSid": "🐙", - "QCid": "128025", - "AQLid": "100", - "QDes": "/章鱼", - "QHide": "1", - "EMCode": "400313" - }, - { - "QSid": "🐷", - "QCid": "128055", - "AQLid": "101", - "QDes": "/猪", - "EMCode": "400343" - }, - { - "QSid": "💀", - "QCid": "128128", - "AQLid": "102", - "QDes": "/骷髅", - "QHide": "1", - "EMCode": "400572" - }, - { - "QSid": "🐤", - "QCid": "128036", - "AQLid": "103", - "QDes": "/小鸡", - "QHide": "1", - "EMCode": "400324" - }, - { - "QSid": "🐨", - "QCid": "128040", - "AQLid": "104", - "QDes": "/树懒", - "QHide": "1", - "EMCode": "400328" - }, - { - "QSid": "🐮", - "QCid": "128046", - "AQLid": "105", - "QDes": "/牛", - "EMCode": "400334" - }, - { - "QSid": "🐔", - "QCid": "128020", - "AQLid": "106", - "QDes": "/公鸡", - "EMCode": "400308" - }, - { - "QSid": "🐸", - "QCid": "128056", - "AQLid": "107", - "QDes": "/青蛙", - "EMCode": "400344" - }, - { - "QSid": "👻", - "QCid": "128123", - "AQLid": "108", - "QDes": "/幽灵", - "EMCode": "400562" - }, - { - "QSid": "🐛", - "QCid": "128027", - "AQLid": "109", - "QDes": "/虫", - "EMCode": "400315" - }, - { - "QSid": "🐠", - "QCid": "128032", - "AQLid": "110", - "QDes": "/鱼", - "QHide": "1", - "EMCode": "400320" - }, - { - "QSid": "🐶", - "QCid": "128054", - "AQLid": "111", - "QDes": "/狗", - "EMCode": "400342" - }, - { - "QSid": "🐯", - "QCid": "128047", - "AQLid": "112", - "QDes": "/老虎", - "QHide": "1", - "EMCode": "400335" - }, - { - "QSid": "👼", - "QCid": "128124", - "AQLid": "113", - "QDes": "/天使", - "QHide": "1", - "EMCode": "400563" - }, - { - "QSid": "🐧", - "QCid": "128039", - "AQLid": "114", - "QDes": "/企鹅", - "QHide": "1", - "EMCode": "400327" - }, - { - "QSid": "🐳", - "QCid": "128051", - "AQLid": "115", - "QDes": "/鲸鱼", - "EMCode": "400339" - }, - { - "QSid": "🐭", - "QCid": "128045", - "AQLid": "116", - "QDes": "/老鼠", - "QHide": "1", - "EMCode": "400333" - }, - { - "QSid": "👒", - "QCid": "128082", - "AQLid": "117", - "QDes": "/帽子", - "QHide": "1", - "EMCode": "400433" - }, - { - "QSid": "👗", - "QCid": "128087", - "AQLid": "118", - "QDes": "/连衣裙", - "QHide": "1", - "EMCode": "400438" - }, - { - "QSid": "💄", - "QCid": "128132", - "AQLid": "119", - "QDes": "/口红", - "QHide": "1", - "EMCode": "400591" - }, - { - "QSid": "👠", - "QCid": "128096", - "AQLid": "120", - "QDes": "/高跟鞋", - "QHide": "1", - "EMCode": "400447" - }, - { - "QSid": "👢", - "QCid": "128098", - "AQLid": "121", - "QDes": "/靴子", - "EMCode": "400449" - }, - { - "QSid": "🌂", - "QCid": "127746", - "AQLid": "122", - "QDes": "/雨伞", - "QHide": "1", - "EMCode": "400077" - }, - { - "QSid": "👜", - "QCid": "128092", - "AQLid": "123", - "QDes": "/包", - "QHide": "1", - "EMCode": "400443" - }, - { - "QSid": "👙", - "QCid": "128089", - "AQLid": "124", - "QDes": "/内衣", - "QHide": "1", - "EMCode": "400440" - }, - { - "QSid": "👕", - "QCid": "128085", - "AQLid": "125", - "QDes": "/衣服", - "QHide": "1", - "EMCode": "400436" - }, - { - "QSid": "👟", - "QCid": "128095", - "AQLid": "126", - "QDes": "/鞋子", - "QHide": "1", - "EMCode": "400446" - }, - { - "QSid": "☁", - "QCid": "9729", - "AQLid": "127", - "QDes": "/云朵", - "QHide": "1", - "EMCode": "401329" - }, - { - "QSid": "☀", - "QCid": "9728", - "AQLid": "128", - "QDes": "/晴天", - "EMCode": "401328" - }, - { - "QSid": "☔", - "QCid": "9748", - "AQLid": "129", - "QDes": "/雨天", - "QHide": "1", - "EMCode": "401342" - }, - { - "QSid": "🌙", - "QCid": "127769", - "AQLid": "130", - "QDes": "/月亮", - "QHide": "1", - "EMCode": "400100" - }, - { - "QSid": "⛄", - "QCid": "9924", - "AQLid": "131", - "QDes": "/雪人", - "QHide": "1", - "EMCode": "401346" - }, - { - "QSid": "⭕", - "QCid": "11093", - "AQLid": "132", - "QDes": "/正确", - "QHide": "1", - "EMCode": "401687" - }, - { - "QSid": "❌", - "QCid": "10060", - "AQLid": "133", - "QDes": "/错误", - "QHide": "1", - "EMCode": "401142" - }, - { - "QSid": "❔", - "QCid": "10068", - "AQLid": "134", - "QDes": "/问号", - "EMCode": "401145" - }, - { - "QSid": "❕", - "QCid": "10069", - "AQLid": "135", - "QDes": "/叹号", - "QHide": "1", - "EMCode": "401146" - }, - { - "QSid": "☎", - "QCid": "9742", - "AQLid": "136", - "QDes": "/电话", - "QHide": "1", - "EMCode": "401398" - }, - { - "QSid": "📷", - "QCid": "128247", - "AQLid": "137", - "QDes": "/相机", - "QHide": "1", - "EMCode": "400726" - }, - { - "QSid": "📱", - "QCid": "128241", - "AQLid": "138", - "QDes": "/手机", - "QHide": "1", - "EMCode": "400720" - }, - { - "QSid": "📠", - "QCid": "128224", - "AQLid": "139", - "QDes": "/传真", - "QHide": "1", - "EMCode": "400703" - }, - { - "QSid": "💻", - "QCid": "128187", - "AQLid": "140", - "QDes": "/电脑", - "QHide": "1", - "EMCode": "400666" - }, - { - "QSid": "🎥", - "QCid": "127909", - "AQLid": "141", - "QDes": "/摄影机", - "QHide": "1", - "EMCode": "400214" - }, - { - "QSid": "🎤", - "QCid": "127908", - "AQLid": "142", - "QDes": "/话筒", - "QHide": "1", - "EMCode": "400213" - }, - { - "QSid": "🔫", - "QCid": "128299", - "AQLid": "143", - "QDes": "/手枪", - "EMCode": "400774" - }, - { - "QSid": "💿", - "QCid": "128191", - "AQLid": "144", - "QDes": "/光碟", - "QHide": "1", - "EMCode": "400670" - }, - { - "QSid": "💓", - "QCid": "128147", - "AQLid": "145", - "QDes": "/爱心", - "EMCode": "400621" - }, - { - "QSid": "♣", - "QCid": "9827", - "AQLid": "146", - "QDes": "/扑克", - "QHide": "1", - "EMCode": "401385" - }, - { - "QSid": "🀄", - "QCid": "126980", - "AQLid": "147", - "QDes": "/麻将", - "QHide": "1", - "EMCode": "401386" - }, - { - "QSid": "〽", - "QCid": "12349", - "AQLid": "148", - "QDes": "/股票", - "QHide": "1", - "EMCode": "401691" - }, - { - "QSid": "🎰", - "QCid": "127920", - "AQLid": "149", - "QDes": "/老虎机", - "QHide": "1", - "EMCode": "400225" - }, - { - "QSid": "🚥", - "QCid": "128677", - "AQLid": "150", - "QDes": "/信号灯", - "QHide": "1", - "EMCode": "400980" - }, - { - "QSid": "🚧", - "QCid": "128679", - "AQLid": "151", - "QDes": "/路障", - "QHide": "1", - "EMCode": "400982" - }, - { - "QSid": "🎸", - "QCid": "127928", - "AQLid": "152", - "QDes": "/吉他", - "QHide": "1", - "EMCode": "400233" - }, - { - "QSid": "💈", - "QCid": "128136", - "AQLid": "153", - "QDes": "/理发厅", - "QHide": "1", - "EMCode": "400610" - }, - { - "QSid": "🛀", - "QCid": "128704", - "AQLid": "154", - "QDes": "/浴缸", - "QHide": "1", - "EMCode": "401022" - }, - { - "QSid": "🚽", - "QCid": "128701", - "AQLid": "155", - "QDes": "/马桶", - "QHide": "1", - "EMCode": "401019" - }, - { - "QSid": "🏠", - "QCid": "127968", - "AQLid": "156", - "QDes": "/家", - "QHide": "1", - "EMCode": "400271" - }, - { - "QSid": "⛪", - "QCid": "9962", - "AQLid": "157", - "QDes": "/教堂", - "QHide": "1", - "EMCode": "401281" - }, - { - "QSid": "🏦", - "QCid": "127974", - "AQLid": "158", - "QDes": "/银行", - "QHide": "1", - "EMCode": "400277" - }, - { - "QSid": "🏥", - "QCid": "127973", - "AQLid": "159", - "QDes": "/医院", - "QHide": "1", - "EMCode": "400276" - }, - { - "QSid": "🏨", - "QCid": "127976", - "AQLid": "160", - "QDes": "/酒店", - "QHide": "1", - "EMCode": "400279" - }, - { - "QSid": "🏧", - "QCid": "127975", - "AQLid": "161", - "QDes": "/取款机", - "QHide": "1", - "EMCode": "400278" - }, - { - "QSid": "🏪", - "QCid": "127978", - "AQLid": "162", - "QDes": "/便利店", - "EMCode": "400281" - }, - { - "QSid": "🚹", - "QCid": "128697", - "AQLid": "163", - "QDes": "/男性", - "QHide": "1", - "EMCode": "401015" - }, - { - "QSid": "🚺", - "QCid": "128698", - "AQLid": "164", - "QDes": "/女性", - "QHide": "1", - "EMCode": "401016" - } - ] -} \ No newline at end of file + "sysface": [ + { + "QSid": "392", + "QDes": "/龙年快乐", + "IQLid": "392", + "AQLid": "392", + "EMCode": "10392", + "AniStickerType": 3, + "AniStickerPackId": "1", + "AniStickerId": "38" + }, + { + "QSid": "393", + "QDes": "/新年中龙", + "IQLid": "393", + "AQLid": "393", + "EMCode": "10393", + "QHide": "1", + "AniStickerType": 3, + "AniStickerPackId": "1", + "AniStickerId": "39" + }, + { + "QSid": "364", + "QDes": "/超级赞", + "IQLid": "364", + "AQLid": "364", + "EMCode": "10364", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "1", + "AniStickerPackId": "2", + "AniStickerPackName": "汪汪" + }, + { + "QSid": "366", + "QDes": "/芒狗", + "IQLid": "366", + "AQLid": "366", + "EMCode": "10366", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "2", + "AniStickerPackId": "2", + "AniStickerPackName": "汪汪" + }, + { + "QSid": "362", + "QDes": "/好兄弟", + "IQLid": "362", + "AQLid": "362", + "EMCode": "10362", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "3", + "AniStickerPackId": "2", + "AniStickerPackName": "汪汪" + }, + { + "QSid": "397", + "QDes": "/抛媚眼", + "IQLid": "397", + "AQLid": "397", + "EMCode": "10397", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "4", + "AniStickerPackId": "2", + "AniStickerPackName": "汪汪" + }, + { + "QSid": "396", + "QDes": "/狼狗", + "IQLid": "396", + "AQLid": "396", + "EMCode": "10396", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "5", + "AniStickerPackId": "2", + "AniStickerPackName": "汪汪" + }, + { + "QSid": "360", + "QDes": "/亲亲", + "IQLid": "360", + "AQLid": "360", + "EMCode": "10360", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "6", + "AniStickerPackId": "2", + "AniStickerPackName": "汪汪" + }, + { + "QSid": "361", + "QDes": "/狗狗笑哭", + "IQLid": "361", + "AQLid": "361", + "EMCode": "10361", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "7", + "AniStickerPackId": "2", + "AniStickerPackName": "汪汪" + }, + { + "QSid": "363", + "QDes": "/狗狗可怜", + "IQLid": "363", + "AQLid": "363", + "EMCode": "10363", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "8", + "AniStickerPackId": "2", + "AniStickerPackName": "汪汪" + }, + { + "QSid": "365", + "QDes": "/狗狗生气", + "IQLid": "365", + "AQLid": "365", + "EMCode": "10365", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "9", + "AniStickerPackId": "2", + "AniStickerPackName": "汪汪" + }, + { + "QSid": "367", + "QDes": "/狗狗疑问", + "IQLid": "367", + "AQLid": "367", + "EMCode": "10367", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "10", + "AniStickerPackId": "2", + "AniStickerPackName": "汪汪" + }, + { + "QSid": "399", + "QDes": "/tui", + "IQLid": "399", + "AQLid": "399", + "EMCode": "10399", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "1", + "AniStickerPackId": "6", + "AniStickerPackName": "噗噗星人" + }, + { + "QSid": "398", + "QDes": "/超级ok", + "IQLid": "398", + "AQLid": "398", + "EMCode": "10398", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "2", + "AniStickerPackId": "6", + "AniStickerPackName": "噗噗星人" + }, + { + "QSid": "373", + "QDes": "/忙", + "IQLid": "373", + "AQLid": "373", + "EMCode": "10373", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "3", + "AniStickerPackId": "6", + "AniStickerPackName": "噗噗星人" + }, + { + "QSid": "370", + "QDes": "/祝贺", + "IQLid": "370", + "AQLid": "370", + "EMCode": "10370", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "4", + "AniStickerPackId": "6", + "AniStickerPackName": "噗噗星人" + }, + { + "QSid": "375", + "QDes": "/超级鼓掌", + "IQLid": "375", + "AQLid": "375", + "EMCode": "10375", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "5", + "AniStickerPackId": "6", + "AniStickerPackName": "噗噗星人" + }, + { + "QSid": "368", + "QDes": "/奥特笑哭", + "IQLid": "368", + "AQLid": "368", + "EMCode": "10368", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "6", + "AniStickerPackId": "6", + "AniStickerPackName": "噗噗星人" + }, + { + "QSid": "369", + "QDes": "/彩虹", + "IQLid": "369", + "AQLid": "369", + "EMCode": "10369", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "7", + "AniStickerPackId": "6", + "AniStickerPackName": "噗噗星人" + }, + { + "QSid": "371", + "QDes": "/冒泡", + "IQLid": "371", + "AQLid": "371", + "EMCode": "10371", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "8", + "AniStickerPackId": "6", + "AniStickerPackName": "噗噗星人" + }, + { + "QSid": "372", + "QDes": "/气呼呼", + "IQLid": "372", + "AQLid": "372", + "EMCode": "10372", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "9", + "AniStickerPackId": "6", + "AniStickerPackName": "噗噗星人" + }, + { + "QSid": "374", + "QDes": "/波波流泪", + "IQLid": "374", + "AQLid": "374", + "EMCode": "10374", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "10", + "AniStickerPackId": "6", + "AniStickerPackName": "噗噗星人" + }, + { + "QSid": "382", + "QDes": "/emo", + "IQLid": "382", + "AQLid": "382", + "EMCode": "10382", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "1", + "AniStickerPackId": "5", + "AniStickerPackName": "企鹅" + }, + { + "QSid": "383", + "QDes": "/企鹅爱心", + "IQLid": "383", + "AQLid": "383", + "EMCode": "10383", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "2", + "AniStickerPackId": "5", + "AniStickerPackName": "企鹅" + }, + { + "QSid": "401", + "QDes": "/超级转圈", + "IQLid": "401", + "AQLid": "401", + "EMCode": "10401", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "3", + "AniStickerPackId": "5", + "AniStickerPackName": "企鹅" + }, + { + "QSid": "400", + "QDes": "/快乐", + "IQLid": "400", + "AQLid": "400", + "EMCode": "10400", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "4", + "AniStickerPackId": "5", + "AniStickerPackName": "企鹅" + }, + { + "QSid": "380", + "QDes": "/真棒", + "IQLid": "380", + "AQLid": "380", + "EMCode": "10380", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "5", + "AniStickerPackId": "5", + "AniStickerPackName": "企鹅" + }, + { + "QSid": "381", + "QDes": "/路过", + "IQLid": "381", + "AQLid": "381", + "EMCode": "10381", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "6", + "AniStickerPackId": "5", + "AniStickerPackName": "企鹅" + }, + { + "QSid": "379", + "QDes": "/企鹅流泪", + "IQLid": "379", + "AQLid": "379", + "EMCode": "10379", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "7", + "AniStickerPackId": "5", + "AniStickerPackName": "企鹅" + }, + { + "QSid": "376", + "QDes": "/跺脚", + "IQLid": "376", + "AQLid": "376", + "EMCode": "10376", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "8", + "AniStickerPackId": "5", + "AniStickerPackName": "企鹅" + }, + { + "QSid": "378", + "QDes": "/企鹅笑哭", + "IQLid": "378", + "AQLid": "378", + "EMCode": "10378", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "9", + "AniStickerPackId": "5", + "AniStickerPackName": "企鹅" + }, + { + "QSid": "377", + "QDes": "/嗨", + "IQLid": "377", + "AQLid": "377", + "EMCode": "10377", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "10", + "AniStickerPackId": "5", + "AniStickerPackName": "企鹅" + }, + { + "QSid": "403", + "QDes": "/出去玩", + "IQLid": "403", + "AQLid": "403", + "EMCode": "10403", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "1", + "AniStickerPackId": "4", + "AniStickerPackName": "QQ黄脸" + }, + { + "QSid": "402", + "QDes": "/别说话", + "IQLid": "402", + "AQLid": "402", + "EMCode": "10402", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "2", + "AniStickerPackId": "4", + "AniStickerPackName": "QQ黄脸" + }, + { + "QSid": "390", + "QDes": "/太头秃", + "IQLid": "390", + "AQLid": "390", + "EMCode": "10390", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "3", + "AniStickerPackId": "4", + "AniStickerPackName": "QQ黄脸" + }, + { + "QSid": "391", + "QDes": "/太沧桑", + "IQLid": "391", + "AQLid": "391", + "EMCode": "10391", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "4", + "AniStickerPackId": "4", + "AniStickerPackName": "QQ黄脸" + }, + { + "QSid": "388", + "QDes": "/太头疼", + "IQLid": "388", + "AQLid": "388", + "EMCode": "10388", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "5", + "AniStickerPackId": "4", + "AniStickerPackName": "QQ黄脸" + }, + { + "QSid": "389", + "QDes": "/太赞了", + "IQLid": "389", + "AQLid": "389", + "EMCode": "10389", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "6", + "AniStickerPackId": "4", + "AniStickerPackName": "QQ黄脸" + }, + { + "QSid": "386", + "QDes": "/呜呜呜", + "IQLid": "386", + "AQLid": "386", + "EMCode": "10386", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "7", + "AniStickerPackId": "4", + "AniStickerPackName": "QQ黄脸" + }, + { + "QSid": "385", + "QDes": "/太气了", + "IQLid": "385", + "AQLid": "385", + "EMCode": "10385", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "8", + "AniStickerPackId": "4", + "AniStickerPackName": "QQ黄脸" + }, + { + "QSid": "384", + "QDes": "/晚安", + "IQLid": "384", + "AQLid": "384", + "EMCode": "10384", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "9", + "AniStickerPackId": "4", + "AniStickerPackName": "QQ黄脸" + }, + { + "QSid": "387", + "QDes": "/太好笑", + "IQLid": "387", + "AQLid": "387", + "EMCode": "10387", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "10", + "AniStickerPackId": "4", + "AniStickerPackName": "QQ黄脸" + }, + { + "QSid": "413", + "QDes": "/摇起来", + "IQLid": "413", + "AQLid": "413", + "EMCode": "10413", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "1", + "AniStickerPackId": "3", + "AniStickerPackName": "喜花妮" + }, + { + "QSid": "405", + "QDes": "/好运来", + "IQLid": "405", + "AQLid": "405", + "EMCode": "10405", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "2", + "AniStickerPackId": "3", + "AniStickerPackName": "喜花妮" + }, + { + "QSid": "404", + "QDes": "/闪亮登场", + "IQLid": "404", + "AQLid": "404", + "EMCode": "10404", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "3", + "AniStickerPackId": "3", + "AniStickerPackName": "喜花妮" + }, + { + "QSid": "406", + "QDes": "/姐是女王", + "IQLid": "406", + "AQLid": "406", + "EMCode": "10406", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "4", + "AniStickerPackId": "3", + "AniStickerPackName": "喜花妮" + }, + { + "QSid": "410", + "QDes": "/么么哒", + "IQLid": "410", + "AQLid": "410", + "EMCode": "10410", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "5", + "AniStickerPackId": "3", + "AniStickerPackName": "喜花妮" + }, + { + "QSid": "411", + "QDes": "/一起嗨", + "IQLid": "411", + "AQLid": "411", + "EMCode": "10411", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "6", + "AniStickerPackId": "3", + "AniStickerPackName": "喜花妮" + }, + { + "QSid": "407", + "QDes": "/我听听", + "IQLid": "407", + "AQLid": "407", + "EMCode": "10407", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "7", + "AniStickerPackId": "3", + "AniStickerPackName": "喜花妮" + }, + { + "QSid": "408", + "QDes": "/臭美", + "IQLid": "408", + "AQLid": "408", + "EMCode": "10408", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "8", + "AniStickerPackId": "3", + "AniStickerPackName": "喜花妮" + }, + { + "QSid": "412", + "QDes": "/开心", + "IQLid": "412", + "AQLid": "412", + "EMCode": "10412", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "9", + "AniStickerPackId": "3", + "AniStickerPackName": "喜花妮" + }, + { + "QSid": "409", + "QDes": "/送你花花", + "IQLid": "409", + "AQLid": "409", + "EMCode": "10409", + "QHide": "1", + "AniStickerType": 1, + "AniStickerId": "10", + "AniStickerPackId": "3", + "AniStickerPackName": "喜花妮" + }, + { + "QSid": "394", + "QDes": "/新年大龙", + "IQLid": "394", + "AQLid": "394", + "EMCode": "10394", + "QHide": "1", + "AniStickerType": 3, + "AniStickerPackId": "1", + "AniStickerId": "40" + }, + { + "QSid": "14", + "QDes": "/微笑", + "IQLid": "23", + "AQLid": "23", + "EMCode": "100" + }, + { + "QSid": "1", + "QDes": "/撇嘴", + "IQLid": "40", + "AQLid": "40", + "EMCode": "101" + }, + { + "QSid": "2", + "QDes": "/色", + "IQLid": "19", + "AQLid": "19", + "EMCode": "102" + }, + { + "QSid": "3", + "QDes": "/发呆", + "IQLid": "43", + "AQLid": "43", + "EMCode": "103" + }, + { + "QSid": "4", + "QDes": "/得意", + "IQLid": "21", + "AQLid": "21", + "EMCode": "104" + }, + { + "QSid": "6", + "QDes": "/害羞", + "IQLid": "20", + "AQLid": "20", + "EMCode": "106" + }, + { + "QSid": "7", + "QDes": "/闭嘴", + "IQLid": "104", + "AQLid": "106", + "EMCode": "107" + }, + { + "QSid": "8", + "QDes": "/睡", + "IQLid": "35", + "AQLid": "35", + "EMCode": "108" + }, + { + "QSid": "9", + "QDes": "/大哭", + "IQLid": "10", + "AQLid": "10", + "EMCode": "109" + }, + { + "QSid": "5", + "QDes": "/流泪", + "IQLid": "9", + "AQLid": "9", + "EMCode": "105", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "16" + }, + { + "QSid": "10", + "QDes": "/尴尬", + "IQLid": "25", + "AQLid": "25", + "EMCode": "110" + }, + { + "QSid": "11", + "QDes": "/发怒", + "IQLid": "24", + "AQLid": "24", + "EMCode": "111" + }, + { + "QSid": "12", + "QDes": "/调皮", + "IQLid": "1", + "AQLid": "1", + "EMCode": "112" + }, + { + "QSid": "13", + "QDes": "/呲牙", + "IQLid": "0", + "AQLid": "0", + "EMCode": "113" + }, + { + "QSid": "0", + "QDes": "/惊讶", + "IQLid": "33", + "AQLid": "33", + "EMCode": "114" + }, + { + "QSid": "15", + "QDes": "/难过", + "IQLid": "32", + "AQLid": "32", + "EMCode": "115" + }, + { + "QSid": "16", + "QDes": "/酷", + "IQLid": "12", + "AQLid": "12", + "EMCode": "116" + }, + { + "QSid": "96", + "QDes": "/冷汗", + "IQLid": "27", + "AQLid": "27", + "EMCode": "117" + }, + { + "QSid": "18", + "QDes": "/抓狂", + "IQLid": "13", + "AQLid": "13", + "EMCode": "118" + }, + { + "QSid": "19", + "QDes": "/吐", + "IQLid": "22", + "AQLid": "22", + "EMCode": "119" + }, + { + "QSid": "20", + "QDes": "/偷笑", + "IQLid": "3", + "AQLid": "3", + "EMCode": "120" + }, + { + "QSid": "21", + "QDes": "/可爱", + "IQLid": "18", + "AQLid": "18", + "EMCode": "121" + }, + { + "QSid": "22", + "QDes": "/白眼", + "IQLid": "30", + "AQLid": "30", + "EMCode": "122" + }, + { + "QSid": "23", + "QDes": "/傲慢", + "IQLid": "31", + "AQLid": "31", + "EMCode": "123" + }, + { + "QSid": "24", + "QDes": "/饥饿", + "IQLid": "79", + "AQLid": "81", + "EMCode": "124" + }, + { + "QSid": "25", + "QDes": "/困", + "IQLid": "80", + "AQLid": "82", + "EMCode": "125" + }, + { + "QSid": "26", + "QDes": "/惊恐", + "IQLid": "26", + "AQLid": "26", + "EMCode": "126" + }, + { + "QSid": "27", + "QDes": "/流汗", + "IQLid": "2", + "AQLid": "2", + "EMCode": "127" + }, + { + "QSid": "28", + "QDes": "/憨笑", + "IQLid": "37", + "AQLid": "37", + "EMCode": "128" + }, + { + "QSid": "29", + "QDes": "/悠闲", + "IQLid": "50", + "AQLid": "50", + "EMCode": "129" + }, + { + "QSid": "30", + "QDes": "/奋斗", + "IQLid": "42", + "AQLid": "42", + "EMCode": "130" + }, + { + "QSid": "31", + "QDes": "/咒骂", + "IQLid": "81", + "AQLid": "83", + "EMCode": "131" + }, + { + "QSid": "32", + "QDes": "/疑问", + "IQLid": "34", + "AQLid": "34", + "EMCode": "132" + }, + { + "QSid": "33", + "QDes": "/嘘", + "IQLid": "11", + "AQLid": "11", + "EMCode": "133" + }, + { + "QSid": "34", + "QDes": "/晕", + "IQLid": "49", + "AQLid": "49", + "EMCode": "134" + }, + { + "QSid": "35", + "QDes": "/折磨", + "IQLid": "82", + "AQLid": "84", + "EMCode": "135" + }, + { + "QSid": "36", + "QDes": "/衰", + "IQLid": "39", + "AQLid": "39", + "EMCode": "136" + }, + { + "QSid": "37", + "QDes": "/骷髅", + "isStatic": "1", + "IQLid": "76", + "AQLid": "78", + "EMCode": "137" + }, + { + "QSid": "38", + "QDes": "/敲打", + "IQLid": "5", + "AQLid": "5", + "EMCode": "138" + }, + { + "QSid": "39", + "QDes": "/再见", + "IQLid": "4", + "AQLid": "4", + "EMCode": "139" + }, + { + "QSid": "97", + "QDes": "/擦汗", + "IQLid": "6", + "AQLid": "6", + "EMCode": "140" + }, + { + "QSid": "98", + "QDes": "/抠鼻", + "IQLid": "83", + "AQLid": "85", + "EMCode": "141" + }, + { + "QSid": "99", + "QDes": "/鼓掌", + "IQLid": "84", + "AQLid": "86", + "EMCode": "142" + }, + { + "QSid": "100", + "QDes": "/糗大了", + "IQLid": "85", + "AQLid": "87", + "EMCode": "143" + }, + { + "QSid": "101", + "QDes": "/坏笑", + "IQLid": "46", + "AQLid": "46", + "EMCode": "144" + }, + { + "QSid": "102", + "QDes": "/左哼哼", + "IQLid": "86", + "AQLid": "88", + "EMCode": "145" + }, + { + "QSid": "103", + "QDes": "/右哼哼", + "IQLid": "44", + "AQLid": "44", + "EMCode": "146" + }, + { + "QSid": "104", + "QDes": "/哈欠", + "IQLid": "87", + "AQLid": "89", + "EMCode": "147" + }, + { + "QSid": "105", + "QDes": "/鄙视", + "IQLid": "48", + "AQLid": "48", + "EMCode": "148" + }, + { + "QSid": "106", + "QDes": "/委屈", + "IQLid": "14", + "AQLid": "14", + "EMCode": "149" + }, + { + "QSid": "107", + "QDes": "/快哭了", + "IQLid": "88", + "AQLid": "90", + "EMCode": "150" + }, + { + "QSid": "108", + "QDes": "/阴险", + "IQLid": "41", + "AQLid": "41", + "EMCode": "151" + }, + { + "QSid": "305", + "QDes": "/右亲亲", + "IQLid": "305", + "AQLid": "305", + "EMCode": "10305" + }, + { + "QSid": "109", + "QDes": "/左亲亲", + "IQLid": "36", + "AQLid": "36", + "EMCode": "152" + }, + { + "QSid": "110", + "QDes": "/吓", + "IQLid": "89", + "AQLid": "91", + "EMCode": "153" + }, + { + "QSid": "111", + "QDes": "/可怜", + "IQLid": "51", + "AQLid": "51", + "EMCode": "154" + }, + { + "QSid": "172", + "QDes": "/眨眼睛", + "IQLid": "142", + "AQLid": "164", + "EMCode": "242" + }, + { + "QSid": "182", + "QDes": "/笑哭", + "IQLid": "152", + "AQLid": "174", + "EMCode": "252" + }, + { + "QSid": "179", + "QDes": "/doge", + "IQLid": "149", + "AQLid": "171", + "EMCode": "249" + }, + { + "QSid": "173", + "QDes": "/泪奔", + "IQLid": "143", + "AQLid": "165", + "EMCode": "243" + }, + { + "QSid": "174", + "QDes": "/无奈", + "IQLid": "144", + "AQLid": "166", + "EMCode": "244" + }, + { + "QSid": "212", + "QDes": "/托腮", + "IQLid": "182", + "AQLid": "161", + "EMCode": "282" + }, + { + "QSid": "175", + "QDes": "/卖萌", + "IQLid": "145", + "AQLid": "167", + "EMCode": "245" + }, + { + "QSid": "178", + "QDes": "/斜眼笑", + "IQLid": "148", + "AQLid": "170", + "EMCode": "248" + }, + { + "QSid": "177", + "QDes": "/喷血", + "IQLid": "147", + "AQLid": "169", + "EMCode": "247" + }, + { + "QSid": "176", + "QDes": "/小纠结", + "IQLid": "146", + "AQLid": "168", + "EMCode": "246" + }, + { + "QSid": "183", + "QDes": "/我最美", + "IQLid": "153", + "AQLid": "175", + "EMCode": "253" + }, + { + "QSid": "262", + "QDes": "/脑阔疼", + "IQLid": "262", + "AQLid": "262", + "EMCode": "10262" + }, + { + "QSid": "263", + "QDes": "/沧桑", + "IQLid": "263", + "AQLid": "263", + "EMCode": "10263" + }, + { + "QSid": "264", + "QDes": "/捂脸", + "IQLid": "264", + "AQLid": "264", + "EMCode": "10264" + }, + { + "QSid": "265", + "QDes": "/辣眼睛", + "IQLid": "265", + "AQLid": "265", + "EMCode": "10265" + }, + { + "QSid": "266", + "QDes": "/哦哟", + "IQLid": "266", + "AQLid": "266", + "EMCode": "10266" + }, + { + "QSid": "267", + "QDes": "/头秃", + "IQLid": "267", + "AQLid": "267", + "EMCode": "10267" + }, + { + "QSid": "268", + "QDes": "/问号脸", + "IQLid": "268", + "AQLid": "268", + "EMCode": "10268" + }, + { + "QSid": "269", + "QDes": "/暗中观察", + "IQLid": "269", + "AQLid": "269", + "EMCode": "10269" + }, + { + "QSid": "270", + "QDes": "/emm", + "IQLid": "270", + "AQLid": "270", + "EMCode": "10270" + }, + { + "QSid": "271", + "QDes": "/吃瓜", + "IQLid": "271", + "AQLid": "271", + "EMCode": "10271" + }, + { + "QSid": "272", + "QDes": "/呵呵哒", + "IQLid": "272", + "AQLid": "272", + "EMCode": "10272" + }, + { + "QSid": "277", + "QDes": "/汪汪", + "IQLid": "277", + "AQLid": "277", + "EMCode": "10277" + }, + { + "QSid": "307", + "QDes": "/喵喵", + "IQLid": "307", + "AQLid": "307", + "EMCode": "10307" + }, + { + "QSid": "306", + "QDes": "/牛气冲天", + "isStatic": "1", + "IQLid": "306", + "AQLid": "306", + "EMCode": "10306" + }, + { + "QSid": "281", + "QDes": "/无眼笑", + "IQLid": "281", + "AQLid": "281", + "EMCode": "10281" + }, + { + "QSid": "282", + "QDes": "/敬礼", + "IQLid": "282", + "AQLid": "282", + "EMCode": "10282" + }, + { + "QSid": "283", + "QDes": "/狂笑", + "IQLid": "283", + "AQLid": "283", + "EMCode": "10283" + }, + { + "QSid": "284", + "QDes": "/面无表情", + "IQLid": "284", + "AQLid": "284", + "EMCode": "10284" + }, + { + "QSid": "285", + "QDes": "/摸鱼", + "IQLid": "285", + "AQLid": "285", + "EMCode": "10285" + }, + { + "QSid": "293", + "QDes": "/摸锦鲤", + "IQLid": "293", + "AQLid": "293", + "EMCode": "10293" + }, + { + "QSid": "286", + "QDes": "/魔鬼笑", + "IQLid": "286", + "AQLid": "286", + "EMCode": "10286" + }, + { + "QSid": "287", + "QDes": "/哦", + "IQLid": "287", + "AQLid": "287", + "EMCode": "10287" + }, + { + "QSid": "289", + "QDes": "/睁眼", + "IQLid": "289", + "AQLid": "289", + "EMCode": "10289" + }, + { + "QSid": "294", + "QDes": "/期待", + "IQLid": "294", + "AQLid": "294", + "EMCode": "10294" + }, + { + "QSid": "297", + "QDes": "/拜谢", + "IQLid": "297", + "AQLid": "297", + "EMCode": "10297" + }, + { + "QSid": "298", + "QDes": "/元宝", + "IQLid": "298", + "AQLid": "298", + "EMCode": "10298" + }, + { + "QSid": "299", + "QDes": "/牛啊", + "IQLid": "299", + "AQLid": "299", + "EMCode": "10299" + }, + { + "QSid": "300", + "QDes": "/胖三斤", + "IQLid": "300", + "AQLid": "300", + "EMCode": "10300" + }, + { + "QSid": "323", + "QDes": "/嫌弃", + "IQLid": "323", + "AQLid": "323", + "EMCode": "10323" + }, + { + "QSid": "332", + "QDes": "/举牌牌", + "IQLid": "332", + "AQLid": "332", + "EMCode": "10332" + }, + { + "QSid": "336", + "QDes": "/豹富", + "IQLid": "336", + "AQLid": "336", + "EMCode": "10336" + }, + { + "QSid": "353", + "QDes": "/拜托", + "IQLid": "353", + "AQLid": "353", + "EMCode": "10353" + }, + { + "QSid": "355", + "QDes": "/耶", + "IQLid": "355", + "AQLid": "355", + "EMCode": "10355" + }, + { + "QSid": "356", + "QDes": "/666", + "IQLid": "356", + "AQLid": "356", + "EMCode": "10356" + }, + { + "QSid": "354", + "QDes": "/尊嘟假嘟", + "IQLid": "354", + "AQLid": "354", + "EMCode": "10354" + }, + { + "QSid": "352", + "QDes": "/咦", + "IQLid": "352", + "AQLid": "352", + "EMCode": "10352" + }, + { + "QSid": "357", + "QDes": "/裂开", + "IQLid": "357", + "AQLid": "357", + "EMCode": "10357" + }, + { + "QSid": "334", + "QDes": "/虎虎生威", + "IQLid": "334", + "AQLid": "334", + "EMCode": "10334" + }, + { + "QSid": "347", + "QDes": "/大展宏兔", + "IQLid": "347", + "AQLid": "347", + "EMCode": "10347" + }, + { + "QSid": "303", + "QDes": "/右拜年", + "IQLid": "303", + "AQLid": "303", + "EMCode": "10303" + }, + { + "QSid": "302", + "QDes": "/左拜年", + "IQLid": "302", + "AQLid": "302", + "EMCode": "10302" + }, + { + "QSid": "295", + "QDes": "/拿到红包", + "IQLid": "295", + "AQLid": "295", + "EMCode": "10295" + }, + { + "QSid": "311", + "QDes": "/打call", + "IQLid": "311", + "AQLid": "311", + "EMCode": "10311", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "1" + }, + { + "QSid": "312", + "QDes": "/变形", + "IQLid": "312", + "AQLid": "312", + "EMCode": "10312", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "2" + }, + { + "QSid": "314", + "QDes": "/仔细分析", + "IQLid": "314", + "AQLid": "314", + "EMCode": "10314", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "4" + }, + { + "QSid": "317", + "QDes": "/菜汪", + "IQLid": "317", + "AQLid": "317", + "EMCode": "10317", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "7" + }, + { + "QSid": "318", + "QDes": "/崇拜", + "IQLid": "318", + "AQLid": "318", + "EMCode": "10318", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "8" + }, + { + "QSid": "319", + "QDes": "/比心", + "IQLid": "319", + "AQLid": "319", + "EMCode": "10319", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "9" + }, + { + "QSid": "320", + "QDes": "/庆祝", + "IQLid": "320", + "AQLid": "320", + "EMCode": "10320", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "10" + }, + { + "QSid": "324", + "QDes": "/吃糖", + "IQLid": "324", + "AQLid": "324", + "EMCode": "10324", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "12" + }, + { + "QSid": "325", + "QDes": "/惊吓", + "IQLid": "325", + "AQLid": "325", + "EMCode": "10325", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "14" + }, + { + "QSid": "337", + "QDes": "/花朵脸", + "IQLid": "337", + "AQLid": "337", + "EMCode": "10337", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "22" + }, + { + "QSid": "338", + "QDes": "/我想开了", + "IQLid": "338", + "AQLid": "338", + "EMCode": "10338", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "20" + }, + { + "QSid": "339", + "QDes": "/舔屏", + "IQLid": "339", + "AQLid": "339", + "EMCode": "10339", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "21" + }, + { + "QSid": "341", + "QDes": "/打招呼", + "IQLid": "341", + "AQLid": "341", + "EMCode": "10341", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "24" + }, + { + "QSid": "342", + "QDes": "/酸Q", + "IQLid": "342", + "AQLid": "342", + "EMCode": "10342", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "26" + }, + { + "QSid": "343", + "QDes": "/我方了", + "IQLid": "343", + "AQLid": "343", + "EMCode": "10343", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "27" + }, + { + "QSid": "344", + "QDes": "/大怨种", + "IQLid": "344", + "AQLid": "344", + "EMCode": "10344", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "28" + }, + { + "QSid": "345", + "QDes": "/红包多多", + "IQLid": "345", + "AQLid": "345", + "EMCode": "10345", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "29" + }, + { + "QSid": "346", + "QDes": "/你真棒棒", + "IQLid": "346", + "AQLid": "346", + "EMCode": "10346", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "25" + }, + { + "QSid": "181", + "QDes": "/戳一戳", + "IQLid": "151", + "AQLid": "173", + "EMCode": "251", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "37" + }, + { + "QSid": "74", + "QDes": "/太阳", + "isStatic": "1", + "IQLid": "73", + "AQLid": "75", + "EMCode": "176", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "35" + }, + { + "QSid": "75", + "QDes": "/月亮", + "isStatic": "1", + "IQLid": "67", + "AQLid": "68", + "EMCode": "175", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "36" + }, + { + "QSid": "351", + "QDes": "/敲敲", + "IQLid": "351", + "AQLid": "351", + "EMCode": "10351", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "30" + }, + { + "QSid": "349", + "QDes": "/坚强", + "IQLid": "349", + "AQLid": "349", + "EMCode": "10349", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "32" + }, + { + "QSid": "350", + "QDes": "/贴贴", + "IQLid": "350", + "AQLid": "350", + "EMCode": "10350", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "31" + }, + { + "QSid": "395", + "QDes": "/略略略", + "IQLid": "395", + "AQLid": "395", + "EMCode": "10395", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "41" + }, + { + "QSid": "114", + "QDes": "/篮球", + "IQLid": "90", + "AQLid": "92", + "EMCode": "158", + "AniStickerType": 2, + "AniStickerPackId": "1", + "AniStickerId": "13" + }, + { + "QSid": "358", + "QDes": "/骰子", + "IQLid": "358", + "AQLid": "358", + "QHide": "1", + "EMCode": "10358", + "AniStickerType": 2, + "AniStickerPackId": "1", + "AniStickerId": "33" + }, + { + "QSid": "359", + "QDes": "/包剪锤", + "IQLid": "359", + "AQLid": "359", + "QHide": "1", + "EMCode": "10359", + "AniStickerType": 2, + "AniStickerPackId": "1", + "AniStickerId": "34" + }, + { + "QSid": "326", + "QDes": "/生气", + "IQLid": "326", + "AQLid": "326", + "EMCode": "10326", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "15" + }, + { + "QSid": "53", + "QDes": "/蛋糕", + "IQLid": "59", + "AQLid": "59", + "EMCode": "168", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "17" + }, + { + "QSid": "49", + "QDes": "/拥抱", + "IQLid": "45", + "AQLid": "45", + "EMCode": "178" + }, + { + "QSid": "66", + "QDes": "/爱心", + "IQLid": "28", + "AQLid": "28", + "EMCode": "166" + }, + { + "QSid": "63", + "QDes": "/玫瑰", + "IQLid": "8", + "AQLid": "8", + "EMCode": "163" + }, + { + "QSid": "64", + "QDes": "/凋谢", + "IQLid": "57", + "AQLid": "57", + "EMCode": "164" + }, + { + "QSid": "187", + "QDes": "/幽灵", + "IQLid": "157", + "AQLid": "179", + "EMCode": "257" + }, + { + "QSid": "146", + "QDes": "/爆筋", + "IQLid": "116", + "AQLid": "118", + "EMCode": "121011" + }, + { + "QSid": "116", + "QDes": "/示爱", + "IQLid": "29", + "AQLid": "29", + "EMCode": "165" + }, + { + "QSid": "67", + "QDes": "/心碎", + "IQLid": "72", + "AQLid": "74", + "EMCode": "167" + }, + { + "QSid": "60", + "QDes": "/咖啡", + "IQLid": "66", + "AQLid": "66", + "EMCode": "160" + }, + { + "QSid": "185", + "QDes": "/羊驼", + "IQLid": "155", + "AQLid": "177", + "EMCode": "255" + }, + { + "QSid": "137", + "QDes": "/鞭炮", + "isStatic": "1", + "IQLid": "107", + "AQLid": "109", + "EMCode": "121002", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "18" + }, + { + "QSid": "333", + "QDes": "/烟花", + "isStatic": "1", + "IQLid": "333", + "AQLid": "333", + "EMCode": "10333", + "AniStickerType": 1, + "AniStickerPackId": "1", + "AniStickerId": "19" + }, + { + "QSid": "76", + "QDes": "/赞", + "IQLid": "52", + "AQLid": "52", + "EMCode": "179" + }, + { + "QSid": "124", + "QDes": "/OK", + "IQLid": "64", + "AQLid": "64", + "EMCode": "189" + }, + { + "QSid": "118", + "QDes": "/抱拳", + "IQLid": "56", + "AQLid": "56", + "EMCode": "183" + }, + { + "QSid": "78", + "QDes": "/握手", + "IQLid": "54", + "AQLid": "54", + "EMCode": "181" + }, + { + "QSid": "119", + "QDes": "/勾引", + "IQLid": "63", + "AQLid": "63", + "EMCode": "184" + }, + { + "QSid": "79", + "QDes": "/胜利", + "IQLid": "55", + "AQLid": "55", + "EMCode": "182" + }, + { + "QSid": "120", + "QDes": "/拳头", + "IQLid": "71", + "AQLid": "73", + "EMCode": "185" + }, + { + "QSid": "121", + "QDes": "/差劲", + "IQLid": "70", + "AQLid": "72", + "EMCode": "186" + }, + { + "QSid": "77", + "QDes": "/踩", + "IQLid": "53", + "AQLid": "53", + "EMCode": "180" + }, + { + "QSid": "123", + "QDes": "/NO", + "IQLid": "92", + "AQLid": "94", + "EMCode": "188" + }, + { + "QSid": "201", + "QDes": "/点赞", + "IQLid": "171", + "AQLid": "150", + "EMCode": "271" + }, + { + "QSid": "273", + "QDes": "/我酸了", + "isStatic": "1", + "IQLid": "273", + "AQLid": "273", + "EMCode": "10273" + }, + { + "QSid": "46", + "QDes": "/猪头", + "isStatic": "1", + "IQLid": "7", + "AQLid": "7", + "EMCode": "162" + }, + { + "QSid": "112", + "QDes": "/菜刀", + "IQLid": "17", + "AQLid": "17", + "EMCode": "155" + }, + { + "QSid": "56", + "QDes": "/刀", + "IQLid": "68", + "AQLid": "70", + "EMCode": "171" + }, + { + "QSid": "169", + "QDes": "/手枪", + "isStatic": "1", + "IQLid": "139", + "AQLid": "141", + "EMCode": "121034" + }, + { + "QSid": "171", + "QDes": "/茶", + "IQLid": "141", + "AQLid": "163", + "EMCode": "241" + }, + { + "QSid": "59", + "QDes": "/便便", + "IQLid": "15", + "AQLid": "15", + "EMCode": "174" + }, + { + "QSid": "144", + "QDes": "/喝彩", + "isStatic": "1", + "IQLid": "114", + "AQLid": "116", + "EMCode": "121009" + }, + { + "QSid": "147", + "QDes": "/棒棒糖", + "isStatic": "1", + "IQLid": "117", + "AQLid": "119", + "EMCode": "121012" + }, + { + "QSid": "89", + "QDes": "/西瓜", + "isStatic": "1", + "IQLid": "60", + "AQLid": "60", + "EMCode": "156" + }, + { + "QSid": "148", + "QDes": "/喝奶", + "isStatic": "1", + "IQLid": "118", + "AQLid": "120", + "QHide": "1", + "EMCode": "121013" + }, + { + "QSid": "55", + "QDes": "/炸弹", + "isStatic": "1", + "IQLid": "16", + "AQLid": "16", + "QHide": "1", + "EMCode": "170" + }, + { + "QSid": "41", + "QDes": "/发抖", + "isStatic": "1", + "IQLid": "69", + "AQLid": "71", + "EMCode": "193" + }, + { + "QSid": "125", + "QDes": "/转圈", + "IQLid": "95", + "AQLid": "97", + "EMCode": "195" + }, + { + "QSid": "42", + "QDes": "/爱情", + "IQLid": "38", + "AQLid": "38", + "EMCode": "190" + }, + { + "QSid": "43", + "QDes": "/跳跳", + "IQLid": "93", + "AQLid": "95", + "EMCode": "192" + }, + { + "QSid": "86", + "QDes": "/怄火", + "IQLid": "94", + "AQLid": "96", + "EMCode": "194" + }, + { + "QSid": "129", + "QDes": "/挥手", + "IQLid": "77", + "AQLid": "79", + "EMCode": "199" + }, + { + "QSid": "226", + "QDes": "/拍桌", + "IQLid": "196", + "isCMEmoji": "1", + "AQLid": "198", + "QHide": "1", + "EMCode": "297" + }, + { + "QSid": "85", + "QDes": "/飞吻", + "isStatic": "1", + "IQLid": "47", + "AQLid": "47", + "EMCode": "191" + }, + { + "QSid": "215", + "QDes": "/糊脸", + "IQLid": "185", + "isCMEmoji": "1", + "AQLid": "187", + "QHide": "1", + "EMCode": "285" + }, + { + "QSid": "214", + "QDes": "/啵啵", + "IQLid": "184", + "isCMEmoji": "1", + "AQLid": "186", + "QHide": "1", + "EMCode": "284" + }, + { + "QSid": "222", + "QDes": "/抱抱", + "IQLid": "192", + "isCMEmoji": "1", + "AQLid": "194", + "QHide": "1", + "EMCode": "292" + }, + { + "QSid": "203", + "QDes": "/托脸", + "IQLid": "173", + "AQLid": "152", + "QHide": "1", + "EMCode": "273" + }, + { + "QSid": "235", + "QDes": "/颤抖", + "IQLid": "205", + "isCMEmoji": "1", + "AQLid": "207", + "QHide": "1", + "EMCode": "305" + }, + { + "QSid": "241", + "QDes": "/生日快乐", + "IQLid": "211", + "isCMEmoji": "1", + "AQLid": "213", + "QHide": "1", + "EMCode": "311" + }, + { + "QSid": "237", + "QDes": "/偷看", + "IQLid": "207", + "isCMEmoji": "1", + "AQLid": "209", + "QHide": "1", + "EMCode": "307" + }, + { + "QSid": "218", + "QDes": "/舔一舔", + "IQLid": "188", + "isCMEmoji": "1", + "AQLid": "190", + "QHide": "1", + "EMCode": "288" + }, + { + "QSid": "233", + "QDes": "/掐一掐", + "IQLid": "203", + "isCMEmoji": "1", + "AQLid": "205", + "QHide": "1", + "EMCode": "303" + }, + { + "QSid": "232", + "QDes": "/佛系", + "IQLid": "202", + "isCMEmoji": "1", + "AQLid": "204", + "QHide": "1", + "EMCode": "302" + }, + { + "QSid": "238", + "QDes": "/扇脸", + "IQLid": "208", + "isCMEmoji": "1", + "AQLid": "210", + "QHide": "1", + "EMCode": "308" + }, + { + "QSid": "217", + "QDes": "/扯一扯", + "IQLid": "187", + "isCMEmoji": "1", + "AQLid": "189", + "QHide": "1", + "EMCode": "287" + }, + { + "QSid": "225", + "QDes": "/撩一撩", + "IQLid": "195", + "isCMEmoji": "1", + "AQLid": "197", + "QHide": "1", + "EMCode": "296" + }, + { + "QSid": "230", + "QDes": "/嘲讽", + "IQLid": "200", + "isCMEmoji": "1", + "AQLid": "202", + "QHide": "1", + "EMCode": "300" + }, + { + "QSid": "194", + "QDes": "/不开心", + "IQLid": "164", + "AQLid": "143", + "QHide": "1", + "EMCode": "264" + }, + { + "QSid": "210", + "QDes": "/飙泪", + "IQLid": "180", + "AQLid": "159", + "QHide": "1", + "EMCode": "280" + }, + { + "QSid": "193", + "QDes": "/大笑", + "IQLid": "163", + "AQLid": "185", + "QHide": "1", + "EMCode": "263" + }, + { + "QSid": "204", + "QDes": "/吃", + "IQLid": "174", + "AQLid": "153", + "QHide": "1", + "EMCode": "274" + }, + { + "QSid": "200", + "QDes": "/求求", + "IQLid": "170", + "AQLid": "149", + "QHide": "1", + "EMCode": "270" + }, + { + "QSid": "290", + "QDes": "/敲开心", + "IQLid": "290", + "isCMEmoji": "1", + "AQLid": "290", + "QHide": "1", + "EMCode": "20240" + }, + { + "QSid": "224", + "QDes": "/开枪", + "IQLid": "194", + "isCMEmoji": "1", + "AQLid": "196", + "QHide": "1", + "EMCode": "295" + }, + { + "QSid": "229", + "QDes": "/干杯", + "IQLid": "199", + "isCMEmoji": "1", + "AQLid": "201", + "QHide": "1", + "EMCode": "299" + }, + { + "QSid": "221", + "QDes": "/顶呱呱", + "IQLid": "191", + "isCMEmoji": "1", + "AQLid": "193", + "QHide": "1", + "EMCode": "291" + }, + { + "QSid": "219", + "QDes": "/蹭一蹭", + "IQLid": "189", + "isCMEmoji": "1", + "AQLid": "191", + "QHide": "1", + "EMCode": "289" + }, + { + "QSid": "227", + "QDes": "/拍手", + "IQLid": "197", + "isCMEmoji": "1", + "AQLid": "199", + "QHide": "1", + "EMCode": "294" + }, + { + "QSid": "216", + "QDes": "/拍头", + "IQLid": "186", + "isCMEmoji": "1", + "AQLid": "188", + "QHide": "1", + "EMCode": "286" + }, + { + "QSid": "231", + "QDes": "/哼", + "IQLid": "201", + "isCMEmoji": "1", + "AQLid": "203", + "QHide": "1", + "EMCode": "301" + }, + { + "QSid": "244", + "QDes": "/扔狗", + "IQLid": "214", + "isCMEmoji": "1", + "AQLid": "216", + "QHide": "1", + "EMCode": "312" + }, + { + "QSid": "223", + "QDes": "/暴击", + "IQLid": "193", + "isCMEmoji": "1", + "AQLid": "195", + "QHide": "1", + "EMCode": "293" + }, + { + "QSid": "243", + "QDes": "/甩头", + "IQLid": "213", + "isCMEmoji": "1", + "AQLid": "215", + "QHide": "1", + "EMCode": "313" + }, + { + "QSid": "211", + "QDes": "/我不看", + "IQLid": "181", + "AQLid": "160", + "QHide": "1", + "EMCode": "281" + }, + { + "QSid": "292", + "QDes": "/让我康康", + "IQLid": "292", + "isCMEmoji": "1", + "AQLid": "292", + "QHide": "1", + "EMCode": "20242" + }, + { + "QSid": "240", + "QDes": "/喷脸", + "IQLid": "210", + "isCMEmoji": "1", + "AQLid": "212", + "QHide": "1", + "EMCode": "310" + }, + { + "QSid": "180", + "QDes": "/惊喜", + "IQLid": "150", + "AQLid": "172", + "QHide": "1", + "EMCode": "250" + }, + { + "QSid": "122", + "QDes": "/爱你", + "IQLid": "65", + "AQLid": "65", + "QHide": "1", + "EMCode": "187" + }, + { + "QSid": "202", + "QDes": "/无聊", + "IQLid": "172", + "AQLid": "151", + "QHide": "1", + "EMCode": "272" + }, + { + "QSid": "278", + "QDes": "/汗", + "IQLid": "278", + "isCMEmoji": "1", + "AQLid": "278", + "QHide": "1", + "EMCode": "20237" + }, + { + "QSid": "301", + "QDes": "/好闪", + "IQLid": "301", + "AQLid": "301", + "QHide": "1", + "EMCode": "10301" + }, + { + "QSid": "288", + "QDes": "/请", + "IQLid": "288", + "AQLid": "288", + "QHide": "1", + "EMCode": "10288" + }, + { + "QSid": "322", + "QDes": "/拒绝", + "IQLid": "322", + "AQLid": "322", + "QHide": "1", + "EMCode": "10322" + }, + { + "QSid": "198", + "QDes": "/呃", + "IQLid": "168", + "AQLid": "147", + "QHide": "1", + "EMCode": "268" + }, + { + "QSid": "348", + "QDes": "/福萝卜", + "IQLid": "348", + "AQLid": "348", + "QHide": "1", + "EMCode": "10348" + }, + { + "QSid": "206", + "QDes": "/害怕", + "IQLid": "176", + "AQLid": "155", + "QHide": "1", + "EMCode": "276" + }, + { + "QSid": "239", + "QDes": "/原谅", + "IQLid": "209", + "isCMEmoji": "1", + "AQLid": "211", + "QHide": "1", + "EMCode": "309" + } + ], + "emoji": [ + { + "QSid": "😊", + "QCid": "128522", + "AQLid": "0", + "QDes": "/嘿嘿", + "EMCode": "400832" + }, + { + "QSid": "😌", + "QCid": "128524", + "AQLid": "1", + "QDes": "/羞涩", + "EMCode": "400834" + }, + { + "QSid": "😚", + "QCid": "128538", + "AQLid": "2", + "QDes": "/亲亲", + "EMCode": "400848" + }, + { + "QSid": "😓", + "QCid": "128531", + "AQLid": "3", + "QDes": "/汗", + "EMCode": "400841" + }, + { + "QSid": "😰", + "QCid": "128560", + "AQLid": "4", + "QDes": "/紧张", + "EMCode": "400870" + }, + { + "QSid": "😝", + "QCid": "128541", + "AQLid": "5", + "QDes": "/吐舌", + "EMCode": "400851" + }, + { + "QSid": "😁", + "QCid": "128513", + "AQLid": "6", + "QDes": "/呲牙", + "EMCode": "400823" + }, + { + "QSid": "😜", + "QCid": "128540", + "AQLid": "7", + "QDes": "/淘气", + "EMCode": "400850" + }, + { + "QSid": "☺", + "QCid": "9786", + "AQLid": "8", + "QDes": "/可爱", + "EMCode": "401181" + }, + { + "QSid": "😉", + "QCid": "128521", + "AQLid": "9", + "QDes": "/媚眼", + "QHide": "1", + "EMCode": "400831" + }, + { + "QSid": "😍", + "QCid": "128525", + "AQLid": "10", + "QDes": "/花痴", + "EMCode": "400835" + }, + { + "QSid": "😔", + "QCid": "128532", + "AQLid": "11", + "QDes": "/失落", + "EMCode": "400842" + }, + { + "QSid": "😄", + "QCid": "128516", + "AQLid": "12", + "QDes": "/高兴", + "EMCode": "400826" + }, + { + "QSid": "😏", + "QCid": "128527", + "AQLid": "13", + "QDes": "/哼哼", + "EMCode": "400837" + }, + { + "QSid": "😒", + "QCid": "128530", + "AQLid": "14", + "QDes": "/不屑", + "EMCode": "400840" + }, + { + "QSid": "😳", + "QCid": "128563", + "AQLid": "15", + "QDes": "/瞪眼", + "EMCode": "400873" + }, + { + "QSid": "😘", + "QCid": "128536", + "AQLid": "16", + "QDes": "/飞吻", + "EMCode": "400846" + }, + { + "QSid": "😭", + "QCid": "128557", + "AQLid": "17", + "QDes": "/大哭", + "EMCode": "400867" + }, + { + "QSid": "😱", + "QCid": "128561", + "AQLid": "18", + "QDes": "/害怕", + "EMCode": "400871" + }, + { + "QSid": "😂", + "QCid": "128514", + "AQLid": "19", + "QDes": "/激动", + "EMCode": "400824" + }, + { + "QSid": "💪", + "QCid": "128170", + "AQLid": "20", + "QDes": "/肌肉", + "EMCode": "400644" + }, + { + "QSid": "👊", + "QCid": "128074", + "AQLid": "21", + "QDes": "/拳头", + "EMCode": "400390" + }, + { + "QSid": "👍", + "QCid": "128077", + "AQLid": "22", + "QDes": "/厉害", + "EMCode": "400408" + }, + { + "QSid": "☝", + "QCid": "9757", + "AQLid": "23", + "QDes": "/向上", + "QHide": "1", + "EMCode": "401203" + }, + { + "QSid": "👏", + "QCid": "128079", + "AQLid": "24", + "QDes": "/鼓掌", + "EMCode": "400420" + }, + { + "QSid": "✌", + "QCid": "9996", + "AQLid": "25", + "QDes": "/胜利", + "QHide": "1", + "EMCode": "401210" + }, + { + "QSid": "👎", + "QCid": "128078", + "AQLid": "26", + "QDes": "/鄙视", + "EMCode": "400414" + }, + { + "QSid": "🙏", + "QCid": "128591", + "AQLid": "27", + "QDes": "/合十", + "EMCode": "400396" + }, + { + "QSid": "👌", + "QCid": "128076", + "AQLid": "28", + "QDes": "/好的", + "EMCode": "400402" + }, + { + "QSid": "👈", + "QCid": "128072", + "AQLid": "29", + "QDes": "/向左", + "QHide": "1", + "EMCode": "400378" + }, + { + "QSid": "👉", + "QCid": "128073", + "AQLid": "30", + "QDes": "/向右", + "QHide": "1", + "EMCode": "400384" + }, + { + "QSid": "👆", + "QCid": "128070", + "AQLid": "31", + "QDes": "/向上", + "EMCode": "400366" + }, + { + "QSid": "👇", + "QCid": "128071", + "AQLid": "32", + "QDes": "/向下", + "QHide": "1", + "EMCode": "400372" + }, + { + "QSid": "👀", + "QCid": "128064", + "AQLid": "33", + "QDes": "/眼睛", + "EMCode": "400351" + }, + { + "QSid": "👃", + "QCid": "128067", + "AQLid": "34", + "QDes": "/鼻子", + "QHide": "1", + "EMCode": "400358" + }, + { + "QSid": "👄", + "QCid": "128068", + "AQLid": "35", + "QDes": "/嘴唇", + "QHide": "1", + "EMCode": "400364" + }, + { + "QSid": "👂", + "QCid": "128066", + "AQLid": "36", + "QDes": "/耳朵", + "QHide": "1", + "EMCode": "400352" + }, + { + "QSid": "🍚", + "QCid": "127834", + "AQLid": "37", + "QDes": "/米饭", + "QHide": "1", + "EMCode": "400149" + }, + { + "QSid": "🍝", + "QCid": "127837", + "AQLid": "38", + "QDes": "/意面", + "QHide": "1", + "EMCode": "400152" + }, + { + "QSid": "🍜", + "QCid": "127836", + "AQLid": "39", + "QDes": "/拉面", + "EMCode": "400151" + }, + { + "QSid": "🍙", + "QCid": "127833", + "AQLid": "40", + "QDes": "/饭团", + "QHide": "1", + "EMCode": "400148" + }, + { + "QSid": "🍧", + "QCid": "127847", + "AQLid": "41", + "QDes": "/刨冰", + "EMCode": "400162" + }, + { + "QSid": "🍣", + "QCid": "127843", + "AQLid": "42", + "QDes": "/寿司", + "QHide": "1", + "EMCode": "400158" + }, + { + "QSid": "🎂", + "QCid": "127874", + "AQLid": "43", + "QDes": "/蛋糕", + "QHide": "1", + "EMCode": "400186" + }, + { + "QSid": "🍞", + "QCid": "127838", + "AQLid": "44", + "QDes": "/面包", + "EMCode": "400153" + }, + { + "QSid": "🍔", + "QCid": "127828", + "AQLid": "45", + "QDes": "/汉堡", + "QHide": "1", + "EMCode": "400143" + }, + { + "QSid": "🍳", + "QCid": "127859", + "AQLid": "46", + "QDes": "/煎蛋", + "QHide": "1", + "EMCode": "400174" + }, + { + "QSid": "🍟", + "QCid": "127839", + "AQLid": "47", + "QDes": "/薯条", + "QHide": "1", + "EMCode": "400154" + }, + { + "QSid": "🍺", + "QCid": "127866", + "AQLid": "48", + "QDes": "/啤酒", + "EMCode": "400181" + }, + { + "QSid": "🍻", + "QCid": "127867", + "AQLid": "49", + "QDes": "/干杯", + "EMCode": "400182" + }, + { + "QSid": "🍸", + "QCid": "127864", + "AQLid": "50", + "QDes": "/高脚杯", + "QHide": "1", + "EMCode": "400179" + }, + { + "QSid": "☕", + "QCid": "9749", + "AQLid": "51", + "QDes": "/咖啡", + "EMCode": "401262" + }, + { + "QSid": "🍎", + "QCid": "127822", + "AQLid": "52", + "QDes": "/苹果", + "EMCode": "400137" + }, + { + "QSid": "🍊", + "QCid": "127818", + "AQLid": "53", + "QDes": "/橙子", + "QHide": "1", + "EMCode": "400133" + }, + { + "QSid": "🍓", + "QCid": "127827", + "AQLid": "54", + "QDes": "/草莓", + "EMCode": "400142" + }, + { + "QSid": "🍉", + "QCid": "127817", + "AQLid": "55", + "QDes": "/西瓜", + "EMCode": "400132" + }, + { + "QSid": "💊", + "QCid": "128138", + "AQLid": "56", + "QDes": "/药丸", + "QHide": "1", + "EMCode": "400612" + }, + { + "QSid": "🚬", + "QCid": "128684", + "AQLid": "57", + "QDes": "/吸烟", + "EMCode": "400987" + }, + { + "QSid": "🎄", + "QCid": "127876", + "AQLid": "58", + "QDes": "/圣诞树", + "QHide": "1", + "EMCode": "400188" + }, + { + "QSid": "🌹", + "QCid": "127801", + "AQLid": "59", + "QDes": "/玫瑰", + "EMCode": "400116" + }, + { + "QSid": "🎉", + "QCid": "127881", + "AQLid": "60", + "QDes": "/庆祝", + "EMCode": "400198" + }, + { + "QSid": "🌴", + "QCid": "127796", + "AQLid": "61", + "QDes": "/椰子树", + "QHide": "1", + "EMCode": "400112" + }, + { + "QSid": "💝", + "QCid": "128157", + "AQLid": "62", + "QDes": "/礼物", + "EMCode": "400631" + }, + { + "QSid": "🎀", + "QCid": "127872", + "AQLid": "63", + "QDes": "/蝴蝶结", + "QHide": "1", + "EMCode": "400184" + }, + { + "QSid": "🎈", + "QCid": "127880", + "AQLid": "64", + "QDes": "/气球", + "QHide": "1", + "EMCode": "400197" + }, + { + "QSid": "🐚", + "QCid": "128026", + "AQLid": "65", + "QDes": "/海螺", + "QHide": "1", + "EMCode": "400314" + }, + { + "QSid": "💍", + "QCid": "128141", + "AQLid": "66", + "QDes": "/戒指", + "QHide": "1", + "EMCode": "400615" + }, + { + "QSid": "💣", + "QCid": "128163", + "AQLid": "67", + "QDes": "/炸弹", + "EMCode": "400637" + }, + { + "QSid": "👑", + "QCid": "128081", + "AQLid": "68", + "QDes": "/皇冠", + "QHide": "1", + "EMCode": "400432" + }, + { + "QSid": "🔔", + "QCid": "128276", + "AQLid": "69", + "QDes": "/铃铛", + "QHide": "1", + "EMCode": "400751" + }, + { + "QSid": "⭐", + "QCid": "11088", + "AQLid": "70", + "QDes": "/星星", + "QHide": "1", + "EMCode": "401686" + }, + { + "QSid": "✨", + "QCid": "10024", + "AQLid": "71", + "QDes": "/闪光", + "EMCode": "401137" + }, + { + "QSid": "💨", + "QCid": "128168", + "AQLid": "72", + "QDes": "/吹气", + "EMCode": "400642" + }, + { + "QSid": "💦", + "QCid": "128166", + "AQLid": "73", + "QDes": "/水", + "EMCode": "400640" + }, + { + "QSid": "🔥", + "QCid": "128293", + "AQLid": "74", + "QDes": "/火", + "EMCode": "400768" + }, + { + "QSid": "🏆", + "QCid": "127942", + "AQLid": "75", + "QDes": "/奖杯", + "QHide": "1", + "EMCode": "400256" + }, + { + "QSid": "💰", + "QCid": "128176", + "AQLid": "76", + "QDes": "/钱", + "QHide": "1", + "EMCode": "400655" + }, + { + "QSid": "💤", + "QCid": "128164", + "AQLid": "77", + "QDes": "/睡觉", + "EMCode": "400638" + }, + { + "QSid": "⚡", + "QCid": "9889", + "AQLid": "78", + "QDes": "/闪电", + "QHide": "1", + "EMCode": "401685" + }, + { + "QSid": "👣", + "QCid": "128099", + "AQLid": "79", + "QDes": "/脚印", + "QHide": "1", + "EMCode": "400450" + }, + { + "QSid": "💩", + "QCid": "128169", + "AQLid": "80", + "QDes": "/便便", + "EMCode": "400643" + }, + { + "QSid": "💉", + "QCid": "128137", + "AQLid": "81", + "QDes": "/打针", + "EMCode": "400611" + }, + { + "QSid": "♨", + "QCid": "9832", + "AQLid": "82", + "QDes": "/热", + "QHide": "1", + "EMCode": "401287" + }, + { + "QSid": "📫", + "QCid": "128235", + "AQLid": "83", + "QDes": "/邮箱", + "EMCode": "400714" + }, + { + "QSid": "🔑", + "QCid": "128273", + "AQLid": "84", + "QDes": "/钥匙", + "QHide": "1", + "EMCode": "400748" + }, + { + "QSid": "🔒", + "QCid": "128274", + "AQLid": "85", + "QDes": "/锁", + "QHide": "1", + "EMCode": "400749" + }, + { + "QSid": "✈", + "QCid": "9992", + "AQLid": "86", + "QDes": "/飞机", + "QHide": "1", + "EMCode": "401298" + }, + { + "QSid": "🚄", + "QCid": "128644", + "AQLid": "87", + "QDes": "/列车", + "QHide": "1", + "EMCode": "400942" + }, + { + "QSid": "🚗", + "QCid": "128663", + "AQLid": "88", + "QDes": "/汽车", + "QHide": "1", + "EMCode": "400961" + }, + { + "QSid": "🚤", + "QCid": "128676", + "AQLid": "89", + "QDes": "/快艇", + "QHide": "1", + "EMCode": "400979" + }, + { + "QSid": "🚲", + "QCid": "128690", + "AQLid": "90", + "QDes": "/自行车", + "QHide": "1", + "EMCode": "400993" + }, + { + "QSid": "🐎", + "QCid": "128014", + "AQLid": "91", + "QDes": "/骑马", + "EMCode": "400302" + }, + { + "QSid": "🚀", + "QCid": "128640", + "AQLid": "92", + "QDes": "/火箭", + "QHide": "1", + "EMCode": "400938" + }, + { + "QSid": "🚌", + "QCid": "128652", + "AQLid": "93", + "QDes": "/公交", + "QHide": "1", + "EMCode": "400950" + }, + { + "QSid": "⛵", + "QCid": "9973", + "AQLid": "94", + "QDes": "/船", + "QHide": "1", + "EMCode": "401294" + }, + { + "QSid": "👩", + "QCid": "128105", + "AQLid": "95", + "QDes": "/妈妈", + "QHide": "1", + "EMCode": "400482" + }, + { + "QSid": "👨", + "QCid": "128104", + "AQLid": "96", + "QDes": "/爸爸", + "QHide": "1", + "EMCode": "400465" + }, + { + "QSid": "👧", + "QCid": "128103", + "AQLid": "97", + "QDes": "/女孩", + "EMCode": "400459" + }, + { + "QSid": "👦", + "QCid": "128102", + "AQLid": "98", + "QDes": "/男孩", + "EMCode": "400453" + }, + { + "QSid": "🐵", + "QCid": "128053", + "AQLid": "99", + "QDes": "/猴", + "EMCode": "400341" + }, + { + "QSid": "🐙", + "QCid": "128025", + "AQLid": "100", + "QDes": "/章鱼", + "QHide": "1", + "EMCode": "400313" + }, + { + "QSid": "🐷", + "QCid": "128055", + "AQLid": "101", + "QDes": "/猪", + "EMCode": "400343" + }, + { + "QSid": "💀", + "QCid": "128128", + "AQLid": "102", + "QDes": "/骷髅", + "QHide": "1", + "EMCode": "400572" + }, + { + "QSid": "🐤", + "QCid": "128036", + "AQLid": "103", + "QDes": "/小鸡", + "QHide": "1", + "EMCode": "400324" + }, + { + "QSid": "🐨", + "QCid": "128040", + "AQLid": "104", + "QDes": "/树懒", + "QHide": "1", + "EMCode": "400328" + }, + { + "QSid": "🐮", + "QCid": "128046", + "AQLid": "105", + "QDes": "/牛", + "EMCode": "400334" + }, + { + "QSid": "🐔", + "QCid": "128020", + "AQLid": "106", + "QDes": "/公鸡", + "EMCode": "400308" + }, + { + "QSid": "🐸", + "QCid": "128056", + "AQLid": "107", + "QDes": "/青蛙", + "EMCode": "400344" + }, + { + "QSid": "👻", + "QCid": "128123", + "AQLid": "108", + "QDes": "/幽灵", + "EMCode": "400562" + }, + { + "QSid": "🐛", + "QCid": "128027", + "AQLid": "109", + "QDes": "/虫", + "EMCode": "400315" + }, + { + "QSid": "🐠", + "QCid": "128032", + "AQLid": "110", + "QDes": "/鱼", + "QHide": "1", + "EMCode": "400320" + }, + { + "QSid": "🐶", + "QCid": "128054", + "AQLid": "111", + "QDes": "/狗", + "EMCode": "400342" + }, + { + "QSid": "🐯", + "QCid": "128047", + "AQLid": "112", + "QDes": "/老虎", + "QHide": "1", + "EMCode": "400335" + }, + { + "QSid": "👼", + "QCid": "128124", + "AQLid": "113", + "QDes": "/天使", + "QHide": "1", + "EMCode": "400563" + }, + { + "QSid": "🐧", + "QCid": "128039", + "AQLid": "114", + "QDes": "/企鹅", + "QHide": "1", + "EMCode": "400327" + }, + { + "QSid": "🐳", + "QCid": "128051", + "AQLid": "115", + "QDes": "/鲸鱼", + "EMCode": "400339" + }, + { + "QSid": "🐭", + "QCid": "128045", + "AQLid": "116", + "QDes": "/老鼠", + "QHide": "1", + "EMCode": "400333" + }, + { + "QSid": "👒", + "QCid": "128082", + "AQLid": "117", + "QDes": "/帽子", + "QHide": "1", + "EMCode": "400433" + }, + { + "QSid": "👗", + "QCid": "128087", + "AQLid": "118", + "QDes": "/连衣裙", + "QHide": "1", + "EMCode": "400438" + }, + { + "QSid": "💄", + "QCid": "128132", + "AQLid": "119", + "QDes": "/口红", + "QHide": "1", + "EMCode": "400591" + }, + { + "QSid": "👠", + "QCid": "128096", + "AQLid": "120", + "QDes": "/高跟鞋", + "QHide": "1", + "EMCode": "400447" + }, + { + "QSid": "👢", + "QCid": "128098", + "AQLid": "121", + "QDes": "/靴子", + "EMCode": "400449" + }, + { + "QSid": "🌂", + "QCid": "127746", + "AQLid": "122", + "QDes": "/雨伞", + "QHide": "1", + "EMCode": "400077" + }, + { + "QSid": "👜", + "QCid": "128092", + "AQLid": "123", + "QDes": "/包", + "QHide": "1", + "EMCode": "400443" + }, + { + "QSid": "👙", + "QCid": "128089", + "AQLid": "124", + "QDes": "/内衣", + "QHide": "1", + "EMCode": "400440" + }, + { + "QSid": "👕", + "QCid": "128085", + "AQLid": "125", + "QDes": "/衣服", + "QHide": "1", + "EMCode": "400436" + }, + { + "QSid": "👟", + "QCid": "128095", + "AQLid": "126", + "QDes": "/鞋子", + "QHide": "1", + "EMCode": "400446" + }, + { + "QSid": "☁", + "QCid": "9729", + "AQLid": "127", + "QDes": "/云朵", + "QHide": "1", + "EMCode": "401329" + }, + { + "QSid": "☀", + "QCid": "9728", + "AQLid": "128", + "QDes": "/晴天", + "EMCode": "401328" + }, + { + "QSid": "☔", + "QCid": "9748", + "AQLid": "129", + "QDes": "/雨天", + "QHide": "1", + "EMCode": "401342" + }, + { + "QSid": "🌙", + "QCid": "127769", + "AQLid": "130", + "QDes": "/月亮", + "QHide": "1", + "EMCode": "400100" + }, + { + "QSid": "⛄", + "QCid": "9924", + "AQLid": "131", + "QDes": "/雪人", + "QHide": "1", + "EMCode": "401346" + }, + { + "QSid": "⭕", + "QCid": "11093", + "AQLid": "132", + "QDes": "/正确", + "QHide": "1", + "EMCode": "401687" + }, + { + "QSid": "❌", + "QCid": "10060", + "AQLid": "133", + "QDes": "/错误", + "QHide": "1", + "EMCode": "401142" + }, + { + "QSid": "❔", + "QCid": "10068", + "AQLid": "134", + "QDes": "/问号", + "EMCode": "401145" + }, + { + "QSid": "❕", + "QCid": "10069", + "AQLid": "135", + "QDes": "/叹号", + "QHide": "1", + "EMCode": "401146" + }, + { + "QSid": "☎", + "QCid": "9742", + "AQLid": "136", + "QDes": "/电话", + "QHide": "1", + "EMCode": "401398" + }, + { + "QSid": "📷", + "QCid": "128247", + "AQLid": "137", + "QDes": "/相机", + "QHide": "1", + "EMCode": "400726" + }, + { + "QSid": "📱", + "QCid": "128241", + "AQLid": "138", + "QDes": "/手机", + "QHide": "1", + "EMCode": "400720" + }, + { + "QSid": "📠", + "QCid": "128224", + "AQLid": "139", + "QDes": "/传真", + "QHide": "1", + "EMCode": "400703" + }, + { + "QSid": "💻", + "QCid": "128187", + "AQLid": "140", + "QDes": "/电脑", + "QHide": "1", + "EMCode": "400666" + }, + { + "QSid": "🎥", + "QCid": "127909", + "AQLid": "141", + "QDes": "/摄影机", + "QHide": "1", + "EMCode": "400214" + }, + { + "QSid": "🎤", + "QCid": "127908", + "AQLid": "142", + "QDes": "/话筒", + "QHide": "1", + "EMCode": "400213" + }, + { + "QSid": "🔫", + "QCid": "128299", + "AQLid": "143", + "QDes": "/手枪", + "EMCode": "400774" + }, + { + "QSid": "💿", + "QCid": "128191", + "AQLid": "144", + "QDes": "/光碟", + "QHide": "1", + "EMCode": "400670" + }, + { + "QSid": "💓", + "QCid": "128147", + "AQLid": "145", + "QDes": "/爱心", + "EMCode": "400621" + }, + { + "QSid": "♣", + "QCid": "9827", + "AQLid": "146", + "QDes": "/扑克", + "QHide": "1", + "EMCode": "401385" + }, + { + "QSid": "🀄", + "QCid": "126980", + "AQLid": "147", + "QDes": "/麻将", + "QHide": "1", + "EMCode": "401386" + }, + { + "QSid": "〽", + "QCid": "12349", + "AQLid": "148", + "QDes": "/股票", + "QHide": "1", + "EMCode": "401691" + }, + { + "QSid": "🎰", + "QCid": "127920", + "AQLid": "149", + "QDes": "/老虎机", + "QHide": "1", + "EMCode": "400225" + }, + { + "QSid": "🚥", + "QCid": "128677", + "AQLid": "150", + "QDes": "/信号灯", + "QHide": "1", + "EMCode": "400980" + }, + { + "QSid": "🚧", + "QCid": "128679", + "AQLid": "151", + "QDes": "/路障", + "QHide": "1", + "EMCode": "400982" + }, + { + "QSid": "🎸", + "QCid": "127928", + "AQLid": "152", + "QDes": "/吉他", + "QHide": "1", + "EMCode": "400233" + }, + { + "QSid": "💈", + "QCid": "128136", + "AQLid": "153", + "QDes": "/理发厅", + "QHide": "1", + "EMCode": "400610" + }, + { + "QSid": "🛀", + "QCid": "128704", + "AQLid": "154", + "QDes": "/浴缸", + "QHide": "1", + "EMCode": "401022" + }, + { + "QSid": "🚽", + "QCid": "128701", + "AQLid": "155", + "QDes": "/马桶", + "QHide": "1", + "EMCode": "401019" + }, + { + "QSid": "🏠", + "QCid": "127968", + "AQLid": "156", + "QDes": "/家", + "QHide": "1", + "EMCode": "400271" + }, + { + "QSid": "⛪", + "QCid": "9962", + "AQLid": "157", + "QDes": "/教堂", + "QHide": "1", + "EMCode": "401281" + }, + { + "QSid": "🏦", + "QCid": "127974", + "AQLid": "158", + "QDes": "/银行", + "QHide": "1", + "EMCode": "400277" + }, + { + "QSid": "🏥", + "QCid": "127973", + "AQLid": "159", + "QDes": "/医院", + "QHide": "1", + "EMCode": "400276" + }, + { + "QSid": "🏨", + "QCid": "127976", + "AQLid": "160", + "QDes": "/酒店", + "QHide": "1", + "EMCode": "400279" + }, + { + "QSid": "🏧", + "QCid": "127975", + "AQLid": "161", + "QDes": "/取款机", + "QHide": "1", + "EMCode": "400278" + }, + { + "QSid": "🏪", + "QCid": "127978", + "AQLid": "162", + "QDes": "/便利店", + "EMCode": "400281" + }, + { + "QSid": "🚹", + "QCid": "128697", + "AQLid": "163", + "QDes": "/男性", + "QHide": "1", + "EMCode": "401015" + }, + { + "QSid": "🚺", + "QCid": "128698", + "AQLid": "164", + "QDes": "/女性", + "QHide": "1", + "EMCode": "401016" + } + ] +} diff --git a/src/core/helper/rkey.ts b/src/core/helper/rkey.ts index f64a75fe..607fdccf 100644 --- a/src/core/helper/rkey.ts +++ b/src/core/helper/rkey.ts @@ -2,23 +2,25 @@ import { LogWrapper } from '@/common/utils/log'; import { RequestUtil } from '@/common/utils/request'; interface ServerRkeyData { - group_rkey: string; - private_rkey: string; - expired_time: number; + group_rkey: string; + private_rkey: string; + expired_time: number; } export class RkeyManager { serverUrl: string = ''; + logger: LogWrapper; private rkeyData: ServerRkeyData = { group_rkey: '', private_rkey: '', - expired_time: 0 + expired_time: 0, }; - logger: LogWrapper; + constructor(serverUrl: string, logger: LogWrapper) { this.logger = logger; this.serverUrl = serverUrl; } + async getRkey() { if (this.isExpired()) { try { @@ -35,8 +37,9 @@ export class RkeyManager { // console.log(`now: ${now}, expired_time: ${this.rkeyData.expired_time}`); return now > this.rkeyData.expired_time; } + async refreshRkey(): Promise { - //刷新rkey + //刷新rkey this.rkeyData = await RequestUtil.HttpGetJson(this.serverUrl, 'GET'); } } diff --git a/src/core/listeners/NodeIKernelBuddyListener.ts b/src/core/listeners/NodeIKernelBuddyListener.ts index 8ec6a00e..0d1a424f 100644 --- a/src/core/listeners/NodeIKernelBuddyListener.ts +++ b/src/core/listeners/NodeIKernelBuddyListener.ts @@ -3,52 +3,53 @@ import { BuddyCategoryType, FriendRequestNotify } from '@/core/entities'; export type OnBuddyChangeParams = BuddyCategoryType[] interface IBuddyListener { - onBuddyListChangedV2(arg: unknown): void,//V2版本 还没兼容 + onBuddyListChangedV2(arg: unknown): void,//V2版本 还没兼容 - onBuddyListChange(arg: OnBuddyChangeParams): void, + onBuddyListChange(arg: OnBuddyChangeParams): void, - onBuddyInfoChange(arg: unknown): void, + onBuddyInfoChange(arg: unknown): void, - onBuddyDetailInfoChange(arg: unknown): void, + onBuddyDetailInfoChange(arg: unknown): void, - onNickUpdated(arg: unknown): void, + onNickUpdated(arg: unknown): void, - onBuddyRemarkUpdated(arg: unknown): void, + onBuddyRemarkUpdated(arg: unknown): void, - onAvatarUrlUpdated(arg: unknown): void, + onAvatarUrlUpdated(arg: unknown): void, - onBuddyReqChange(arg: FriendRequestNotify): void, + onBuddyReqChange(arg: FriendRequestNotify): void, - onBuddyReqUnreadCntChange(arg: unknown): void, + onBuddyReqUnreadCntChange(arg: unknown): void, - onCheckBuddySettingResult(arg: unknown): void, + onCheckBuddySettingResult(arg: unknown): void, - onAddBuddyNeedVerify(arg: unknown): void, + onAddBuddyNeedVerify(arg: unknown): void, - onSmartInfos(arg: unknown): void, + onSmartInfos(arg: unknown): void, - onSpacePermissionInfos(arg: unknown): void, + onSpacePermissionInfos(arg: unknown): void, - onDoubtBuddyReqChange(arg: unknown): void, + onDoubtBuddyReqChange(arg: unknown): void, - onDoubtBuddyReqUnreadNumChange(arg: unknown): void, + onDoubtBuddyReqUnreadNumChange(arg: unknown): void, - onBlockChanged(arg: unknown): void, + onBlockChanged(arg: unknown): void, - onAddMeSettingChanged(arg: unknown): void, + onAddMeSettingChanged(arg: unknown): void, - onDelBatchBuddyInfos(arg: unknown): void + onDelBatchBuddyInfos(arg: unknown): void } export interface NodeIKernelBuddyListener extends IBuddyListener { - // eslint-disable-next-line @typescript-eslint/no-misused-new - new(listener: IBuddyListener): NodeIKernelBuddyListener; + // eslint-disable-next-line @typescript-eslint/no-misused-new + new(listener: IBuddyListener): NodeIKernelBuddyListener; } export class BuddyListener implements IBuddyListener { onBuddyListChangedV2(arg: unknown): void { - //throw new Error('Method not implemented.'); + //throw new Error('Method not implemented.'); } + onAddBuddyNeedVerify(arg: unknown) { } diff --git a/src/core/listeners/NodeIKernelFileAssistantListener.ts b/src/core/listeners/NodeIKernelFileAssistantListener.ts index 3e034d8c..eb796057 100644 --- a/src/core/listeners/NodeIKernelFileAssistantListener.ts +++ b/src/core/listeners/NodeIKernelFileAssistantListener.ts @@ -1,27 +1,33 @@ export interface IKernelFileAssistantListener { - onFileStatusChanged(...args: unknown[]): unknown; + onFileStatusChanged(...args: unknown[]): unknown; - onSessionListChanged(...args: unknown[]): unknown; + onSessionListChanged(...args: unknown[]): unknown; - onSessionChanged(...args: unknown[]): unknown; + onSessionChanged(...args: unknown[]): unknown; - onFileListChanged(...args: unknown[]): unknown; + onFileListChanged(...args: unknown[]): unknown; - onFileSearch(...args: unknown[]): unknown; + onFileSearch(...args: unknown[]): unknown; } + export interface NodeIKernelFileAssistantListener extends IKernelFileAssistantListener { - // eslint-disable-next-line @typescript-eslint/no-misused-new - new(adapter: IKernelFileAssistantListener): NodeIKernelFileAssistantListener; + // eslint-disable-next-line @typescript-eslint/no-misused-new + new(adapter: IKernelFileAssistantListener): NodeIKernelFileAssistantListener; } export class KernelFileAssistantListener implements IKernelFileAssistantListener { - onFileStatusChanged(...args: unknown[]) { } + onFileStatusChanged(...args: unknown[]) { + } - onSessionListChanged(...args: unknown[]) { } + onSessionListChanged(...args: unknown[]) { + } - onSessionChanged(...args: unknown[]) { } + onSessionChanged(...args: unknown[]) { + } - onFileListChanged(...args: unknown[]) { } + onFileListChanged(...args: unknown[]) { + } - onFileSearch(...args: unknown[]) { } + onFileSearch(...args: unknown[]) { + } } diff --git a/src/core/listeners/NodeIKernelGroupListener.ts b/src/core/listeners/NodeIKernelGroupListener.ts index af5d150b..2faa0764 100644 --- a/src/core/listeners/NodeIKernelGroupListener.ts +++ b/src/core/listeners/NodeIKernelGroupListener.ts @@ -1,64 +1,65 @@ import { Group, GroupListUpdateType, GroupMember, GroupNotify } from '@/core/entities'; interface IGroupListener { - onGroupListUpdate(updateType: GroupListUpdateType, groupList: Group[]): void; + onGroupListUpdate(updateType: GroupListUpdateType, groupList: Group[]): void; - onGroupExtListUpdate(...args: unknown[]): void; + onGroupExtListUpdate(...args: unknown[]): void; - onGroupSingleScreenNotifies(doubt: boolean, seq: string, notifies: GroupNotify[]): void; + onGroupSingleScreenNotifies(doubt: boolean, seq: string, notifies: GroupNotify[]): void; - onGroupNotifiesUpdated(dboubt: boolean, notifies: GroupNotify[]): void; + onGroupNotifiesUpdated(dboubt: boolean, notifies: GroupNotify[]): void; - onGroupNotifiesUnreadCountUpdated(...args: unknown[]): void; + onGroupNotifiesUnreadCountUpdated(...args: unknown[]): void; - onGroupDetailInfoChange(...args: unknown[]): void; + onGroupDetailInfoChange(...args: unknown[]): void; - onGroupAllInfoChange(...args: unknown[]): void; + onGroupAllInfoChange(...args: unknown[]): void; - onGroupsMsgMaskResult(...args: unknown[]): void; + onGroupsMsgMaskResult(...args: unknown[]): void; - onGroupConfMemberChange(...args: unknown[]): void; + onGroupConfMemberChange(...args: unknown[]): void; - onGroupBulletinChange(...args: unknown[]): void; + onGroupBulletinChange(...args: unknown[]): void; - onGetGroupBulletinListResult(...args: unknown[]): void; + onGetGroupBulletinListResult(...args: unknown[]): void; - onMemberListChange(arg: { - sceneId: string, - ids: string[], - infos: Map, - finish: boolean, - hasRobot: boolean - }): void; + onMemberListChange(arg: { + sceneId: string, + ids: string[], + infos: Map, + finish: boolean, + hasRobot: boolean + }): void; - onMemberInfoChange(groupCode: string, changeType: number, members: Map): void; + onMemberInfoChange(groupCode: string, changeType: number, members: Map): void; - onSearchMemberChange(...args: unknown[]): void; + onSearchMemberChange(...args: unknown[]): void; - onGroupBulletinRichMediaDownloadComplete(...args: unknown[]): void; + onGroupBulletinRichMediaDownloadComplete(...args: unknown[]): void; - onGroupBulletinRichMediaProgressUpdate(...args: unknown[]): void; + onGroupBulletinRichMediaProgressUpdate(...args: unknown[]): void; - onGroupStatisticInfoChange(...args: unknown[]): void; + onGroupStatisticInfoChange(...args: unknown[]): void; - onJoinGroupNotify(...args: unknown[]): void; + onJoinGroupNotify(...args: unknown[]): void; - onShutUpMemberListChanged(...args: unknown[]): void; + onShutUpMemberListChanged(...args: unknown[]): void; - onGroupBulletinRemindNotify(...args: unknown[]): void; + onGroupBulletinRemindNotify(...args: unknown[]): void; - onGroupFirstBulletinNotify(...args: unknown[]): void; + onGroupFirstBulletinNotify(...args: unknown[]): void; - onJoinGroupNoVerifyFlag(...args: unknown[]): void; + onJoinGroupNoVerifyFlag(...args: unknown[]): void; - onGroupArkInviteStateResult(...args: unknown[]): void; - // 发现于Win 9.9.9 23159 - onGroupMemberLevelInfoChange(...args: unknown[]): void; + onGroupArkInviteStateResult(...args: unknown[]): void; + + // 发现于Win 9.9.9 23159 + onGroupMemberLevelInfoChange(...args: unknown[]): void; } export interface NodeIKernelGroupListener extends IGroupListener { - // eslint-disable-next-line @typescript-eslint/no-misused-new - new(listener: IGroupListener): NodeIKernelGroupListener; + // eslint-disable-next-line @typescript-eslint/no-misused-new + new(listener: IGroupListener): NodeIKernelGroupListener; } export class GroupListener implements IGroupListener { @@ -66,6 +67,7 @@ export class GroupListener implements IGroupListener { onGroupMemberLevelInfoChange(...args: unknown[]): void { } + onGetGroupBulletinListResult(...args: unknown[]) { } @@ -127,12 +129,12 @@ export class GroupListener implements IGroupListener { } onMemberListChange(arg: { - sceneId: string, - ids: string[], - infos: Map, // uid -> GroupMember - finish: boolean, - hasRobot: boolean - }) { + sceneId: string, + ids: string[], + infos: Map, // uid -> GroupMember + finish: boolean, + hasRobot: boolean + }) { } onSearchMemberChange(...args: unknown[]) { @@ -146,6 +148,7 @@ export class DebugGroupListener implements IGroupListener { onGroupMemberLevelInfoChange(...args: unknown[]): void { console.log('onGroupMemberLevelInfoChange:', ...args); } + onGetGroupBulletinListResult(...args: unknown[]) { console.log('onGetGroupBulletinListResult:', ...args); } diff --git a/src/core/listeners/NodeIKernelLoginListener.ts b/src/core/listeners/NodeIKernelLoginListener.ts index 4ade9fa8..9ffc2395 100644 --- a/src/core/listeners/NodeIKernelLoginListener.ts +++ b/src/core/listeners/NodeIKernelLoginListener.ts @@ -1,42 +1,42 @@ export interface IKernelLoginListener { - onLoginConnected(...args: any[]): void; + onLoginConnected(...args: any[]): void; - onLoginDisConnected(...args: any[]): void; + onLoginDisConnected(...args: any[]): void; - onLoginConnecting(...args: any[]): void; + onLoginConnecting(...args: any[]): void; - onQRCodeGetPicture(...args: any[]): void; + onQRCodeGetPicture(...args: any[]): void; - onQRCodeLoginPollingStarted(...args: any[]): void; + onQRCodeLoginPollingStarted(...args: any[]): void; - onQRCodeSessionUserScaned(...args: any[]): void; + onQRCodeSessionUserScaned(...args: any[]): void; - onQRCodeLoginSucceed(...args: any[]): void; + onQRCodeLoginSucceed(...args: any[]): void; - onQRCodeSessionFailed(...args: any[]): void; + onQRCodeSessionFailed(...args: any[]): void; - onLoginFailed(...args: any[]): void; + onLoginFailed(...args: any[]): void; - onLogoutSucceed(...args: any[]): void; + onLogoutSucceed(...args: any[]): void; - onLogoutFailed(...args: any[]): void; + onLogoutFailed(...args: any[]): void; - onUserLoggedIn(...args: any[]): void; + onUserLoggedIn(...args: any[]): void; - onQRCodeSessionQuickLoginFailed(...args: any[]): void; + onQRCodeSessionQuickLoginFailed(...args: any[]): void; - onPasswordLoginFailed(...args: any[]): void; + onPasswordLoginFailed(...args: any[]): void; - OnConfirmUnusualDeviceFailed(...args: any[]): void; + OnConfirmUnusualDeviceFailed(...args: any[]): void; - onQQLoginNumLimited(...args: any[]): void; + onQQLoginNumLimited(...args: any[]): void; - onLoginState(...args: any[]): void; + onLoginState(...args: any[]): void; } export interface NodeIKernelLoginListener { - // eslint-disable-next-line @typescript-eslint/no-misused-new - new(listener: IKernelLoginListener): NodeIKernelLoginListener; + // eslint-disable-next-line @typescript-eslint/no-misused-new + new(listener: IKernelLoginListener): NodeIKernelLoginListener; } export class LoginListener implements IKernelLoginListener { @@ -50,10 +50,10 @@ export class LoginListener implements IKernelLoginListener { } onQRCodeGetPicture(arg: { pngBase64QrcodeData: string, qrcodeUrl: string }): void { - // let base64Data: string = arg.pngBase64QrcodeData - // base64Data = base64Data.split("data:image/png;base64,")[1] - // let buffer = Buffer.from(base64Data, 'base64') - // console.log("onQRCodeGetPicture", arg); + // let base64Data: string = arg.pngBase64QrcodeData + // base64Data = base64Data.split("data:image/png;base64,")[1] + // let buffer = Buffer.from(base64Data, 'base64') + // console.log("onQRCodeGetPicture", arg); } onQRCodeLoginPollingStarted(...args: any[]): void { @@ -97,12 +97,12 @@ export class LoginListener implements IKernelLoginListener { } export interface QRCodeLoginSucceedResult { - account: string; - mainAccount: string; - uin: string; //拿UIN - uid: string; //拿UID - nickName: string; //一般是空的 拿不到 - gender: number; - age: number; - faceUrl: string;//一般是空的 拿不到 + account: string; + mainAccount: string; + uin: string; //拿UIN + uid: string; //拿UID + nickName: string; //一般是空的 拿不到 + gender: number; + age: number; + faceUrl: string;//一般是空的 拿不到 } diff --git a/src/core/listeners/NodeIKernelMsgListener.ts b/src/core/listeners/NodeIKernelMsgListener.ts index 976bdd13..3b2db538 100644 --- a/src/core/listeners/NodeIKernelMsgListener.ts +++ b/src/core/listeners/NodeIKernelMsgListener.ts @@ -1,37 +1,39 @@ import { ChatType, RawMessage } from '@/core/entities'; export interface OnRichMediaDownloadCompleteParams { - fileModelId: string, - msgElementId: string, - msgId: string, - fileId: string, - fileProgress: string, // '0' - fileSpeed: string, // '0' - fileErrCode: string, // '0' - fileErrMsg: string, - fileDownType: number, // 暂时未知 - thumbSize: number, - filePath: string, - totalSize: string, - trasferStatus: number, - step: number, - commonFileInfo: unknown | null, - fileSrvErrCode: string, - clientMsg: string, - businessId: number, - userTotalSpacePerDay: unknown | null, - userUsedSpacePerDay: unknown | null + fileModelId: string, + msgElementId: string, + msgId: string, + fileId: string, + fileProgress: string, // '0' + fileSpeed: string, // '0' + fileErrCode: string, // '0' + fileErrMsg: string, + fileDownType: number, // 暂时未知 + thumbSize: number, + filePath: string, + totalSize: string, + trasferStatus: number, + step: number, + commonFileInfo: unknown | null, + fileSrvErrCode: string, + clientMsg: string, + businessId: number, + userTotalSpacePerDay: unknown | null, + userUsedSpacePerDay: unknown | null } + export interface onGroupFileInfoUpdateParamType { - retCode: number - retMsg: string - clientWording: string - isEnd: boolean - item: Array - allFileCount: string - nextIndex: string - reqId: string + retCode: number; + retMsg: string; + clientWording: string; + isEnd: boolean; + item: Array; + allFileCount: string; + nextIndex: string; + reqId: string; } + // { // sessionType: 1, // chatType: 100, @@ -41,194 +43,195 @@ export interface onGroupFileInfoUpdateParamType { // sig: '0x' // } export interface TempOnRecvParams { - sessionType: number,//1 - chatType: ChatType,//100 - peerUid: string,//uid - groupCode: string,//gc - fromNick: string,//gc name - sig: string, + sessionType: number,//1 + chatType: ChatType,//100 + peerUid: string,//uid + groupCode: string,//gc + fromNick: string,//gc name + sig: string, } + export interface IKernelMsgListener { - onAddSendMsg(msgRecord: RawMessage): void; + onAddSendMsg(msgRecord: RawMessage): void; - onBroadcastHelperDownloadComplete(broadcastHelperTransNotifyInfo: unknown): void; + onBroadcastHelperDownloadComplete(broadcastHelperTransNotifyInfo: unknown): void; - onBroadcastHelperProgressUpdate(broadcastHelperTransNotifyInfo: unknown): void; + onBroadcastHelperProgressUpdate(broadcastHelperTransNotifyInfo: unknown): void; - onChannelFreqLimitInfoUpdate(contact: unknown, z: unknown, freqLimitInfo: unknown): void; + onChannelFreqLimitInfoUpdate(contact: unknown, z: unknown, freqLimitInfo: unknown): void; - onContactUnreadCntUpdate(hashMap: unknown): void; + onContactUnreadCntUpdate(hashMap: unknown): void; - onCustomWithdrawConfigUpdate(customWithdrawConfig: unknown): void; + onCustomWithdrawConfigUpdate(customWithdrawConfig: unknown): void; - onDraftUpdate(contact: unknown, arrayList: unknown, j2: unknown): void; + onDraftUpdate(contact: unknown, arrayList: unknown, j2: unknown): void; - onEmojiDownloadComplete(emojiNotifyInfo: unknown): void; + onEmojiDownloadComplete(emojiNotifyInfo: unknown): void; - onEmojiResourceUpdate(emojiResourceInfo: unknown): void; + onEmojiResourceUpdate(emojiResourceInfo: unknown): void; - onFeedEventUpdate(firstViewDirectMsgNotifyInfo: unknown): void; + onFeedEventUpdate(firstViewDirectMsgNotifyInfo: unknown): void; - onFileMsgCome(arrayList: unknown): void; + onFileMsgCome(arrayList: unknown): void; - onFirstViewDirectMsgUpdate(firstViewDirectMsgNotifyInfo: unknown): void; + onFirstViewDirectMsgUpdate(firstViewDirectMsgNotifyInfo: unknown): void; - onFirstViewGroupGuildMapping(arrayList: unknown): void; + onFirstViewGroupGuildMapping(arrayList: unknown): void; - onGrabPasswordRedBag(i2: unknown, str: unknown, i3: unknown, recvdOrder: unknown, msgRecord: unknown): void; + onGrabPasswordRedBag(i2: unknown, str: unknown, i3: unknown, recvdOrder: unknown, msgRecord: unknown): void; - onGroupFileInfoAdd(groupItem: unknown): void; + onGroupFileInfoAdd(groupItem: unknown): void; - onGroupFileInfoUpdate(groupFileListResult: onGroupFileInfoUpdateParamType): void; + onGroupFileInfoUpdate(groupFileListResult: onGroupFileInfoUpdateParamType): void; - onGroupGuildUpdate(groupGuildNotifyInfo: unknown): void; + onGroupGuildUpdate(groupGuildNotifyInfo: unknown): void; - onGroupTransferInfoAdd(groupItem: unknown): void; + onGroupTransferInfoAdd(groupItem: unknown): void; - onGroupTransferInfoUpdate(groupFileListResult: unknown): void; + onGroupTransferInfoUpdate(groupFileListResult: unknown): void; - onGuildInteractiveUpdate(guildInteractiveNotificationItem: unknown): void; + onGuildInteractiveUpdate(guildInteractiveNotificationItem: unknown): void; - onGuildMsgAbFlagChanged(guildMsgAbFlag: unknown): void; + onGuildMsgAbFlagChanged(guildMsgAbFlag: unknown): void; - onGuildNotificationAbstractUpdate(guildNotificationAbstractInfo: unknown): void; + onGuildNotificationAbstractUpdate(guildNotificationAbstractInfo: unknown): void; - onHitCsRelatedEmojiResult(downloadRelateEmojiResultInfo: unknown): void; + onHitCsRelatedEmojiResult(downloadRelateEmojiResultInfo: unknown): void; - onHitEmojiKeywordResult(hitRelatedEmojiWordsResult: unknown): void; + onHitEmojiKeywordResult(hitRelatedEmojiWordsResult: unknown): void; - onHitRelatedEmojiResult(relatedWordEmojiInfo: unknown): void; + onHitRelatedEmojiResult(relatedWordEmojiInfo: unknown): void; - onImportOldDbProgressUpdate(importOldDbMsgNotifyInfo: unknown): void; + onImportOldDbProgressUpdate(importOldDbMsgNotifyInfo: unknown): void; - onInputStatusPush(inputStatusInfo: unknown): void; + onInputStatusPush(inputStatusInfo: unknown): void; - onKickedOffLine(kickedInfo: unknown): void; + onKickedOffLine(kickedInfo: unknown): void; - onLineDev(arrayList: unknown): void; + onLineDev(arrayList: unknown): void; - onLogLevelChanged(j2: unknown): void; + onLogLevelChanged(j2: unknown): void; - onMsgAbstractUpdate(arrayList: unknown): void; + onMsgAbstractUpdate(arrayList: unknown): void; - onMsgBoxChanged(arrayList: unknown): void; + onMsgBoxChanged(arrayList: unknown): void; - onMsgDelete(contact: unknown, arrayList: unknown): void; + onMsgDelete(contact: unknown, arrayList: unknown): void; - onMsgEventListUpdate(hashMap: unknown): void; + onMsgEventListUpdate(hashMap: unknown): void; - onMsgInfoListAdd(arrayList: unknown): void; + onMsgInfoListAdd(arrayList: unknown): void; - onMsgInfoListUpdate(msgList: RawMessage[]): void; + onMsgInfoListUpdate(msgList: RawMessage[]): void; - onMsgQRCodeStatusChanged(i2: unknown): void; + onMsgQRCodeStatusChanged(i2: unknown): void; - onMsgRecall(i2: unknown, str: unknown, j2: unknown): void; + onMsgRecall(i2: unknown, str: unknown, j2: unknown): void; - onMsgSecurityNotify(msgRecord: unknown): void; + onMsgSecurityNotify(msgRecord: unknown): void; - onMsgSettingUpdate(msgSetting: unknown): void; + onMsgSettingUpdate(msgSetting: unknown): void; - onNtFirstViewMsgSyncEnd(): void; + onNtFirstViewMsgSyncEnd(): void; - onNtMsgSyncEnd(): void; + onNtMsgSyncEnd(): void; - onNtMsgSyncStart(): void; + onNtMsgSyncStart(): void; - onReadFeedEventUpdate(firstViewDirectMsgNotifyInfo: unknown): void; + onReadFeedEventUpdate(firstViewDirectMsgNotifyInfo: unknown): void; - onRecvGroupGuildFlag(i2: unknown): void; + onRecvGroupGuildFlag(i2: unknown): void; - onRecvMsg(...arrayList: unknown[]): void; + onRecvMsg(...arrayList: unknown[]): void; - onRecvMsgSvrRspTransInfo(j2: unknown, contact: unknown, i2: unknown, i3: unknown, str: unknown, bArr: unknown): void; + onRecvMsgSvrRspTransInfo(j2: unknown, contact: unknown, i2: unknown, i3: unknown, str: unknown, bArr: unknown): void; - onRecvOnlineFileMsg(arrayList: unknown): void; + onRecvOnlineFileMsg(arrayList: unknown): void; - onRecvS2CMsg(arrayList: unknown): void; + onRecvS2CMsg(arrayList: unknown): void; - onRecvSysMsg(arrayList: unknown): void; + onRecvSysMsg(arrayList: unknown): void; - onRecvUDCFlag(i2: unknown): void; + onRecvUDCFlag(i2: unknown): void; - onRichMediaDownloadComplete(fileTransNotifyInfo: OnRichMediaDownloadCompleteParams): void; + onRichMediaDownloadComplete(fileTransNotifyInfo: OnRichMediaDownloadCompleteParams): void; - onRichMediaProgerssUpdate(fileTransNotifyInfo: unknown): void; + onRichMediaProgerssUpdate(fileTransNotifyInfo: unknown): void; - onRichMediaUploadComplete(fileTransNotifyInfo: unknown): void; + onRichMediaUploadComplete(fileTransNotifyInfo: unknown): void; - onSearchGroupFileInfoUpdate(searchGroupFileResult: - { - result: { - retCode: number, - retMsg: string, - clientWording: string - }, - syncCookie: string, - totalMatchCount: number, - ownerMatchCount: number, - isEnd: boolean, - reqId: number, - item: Array<{ - groupCode: string, - groupName: string, - uploaderUin: string, - uploaderName: string, - matchUin: string, - matchWords: Array, - fileNameHits: Array<{ - start: number, - end: number - }>, - fileModelId: string, - fileId: string, - fileName: string, - fileSize: string, - busId: number, - uploadTime: number, - modifyTime: number, - deadTime: number, - downloadTimes: number, - localPath: string - }> - }): void; + onSearchGroupFileInfoUpdate(searchGroupFileResult: + { + result: { + retCode: number, + retMsg: string, + clientWording: string + }, + syncCookie: string, + totalMatchCount: number, + ownerMatchCount: number, + isEnd: boolean, + reqId: number, + item: Array<{ + groupCode: string, + groupName: string, + uploaderUin: string, + uploaderName: string, + matchUin: string, + matchWords: Array, + fileNameHits: Array<{ + start: number, + end: number + }>, + fileModelId: string, + fileId: string, + fileName: string, + fileSize: string, + busId: number, + uploadTime: number, + modifyTime: number, + deadTime: number, + downloadTimes: number, + localPath: string + }> + }): void; - onSendMsgError(j2: unknown, contact: unknown, i2: unknown, str: unknown): void; + onSendMsgError(j2: unknown, contact: unknown, i2: unknown, str: unknown): void; - onSysMsgNotification(i2: unknown, j2: unknown, j3: unknown, arrayList: unknown): void; + onSysMsgNotification(i2: unknown, j2: unknown, j3: unknown, arrayList: unknown): void; - onTempChatInfoUpdate(tempChatInfo: TempOnRecvParams): void; + onTempChatInfoUpdate(tempChatInfo: TempOnRecvParams): void; - onUnreadCntAfterFirstView(hashMap: unknown): void; + onUnreadCntAfterFirstView(hashMap: unknown): void; - onUnreadCntUpdate(hashMap: unknown): void; + onUnreadCntUpdate(hashMap: unknown): void; - onUserChannelTabStatusChanged(z: unknown): void; + onUserChannelTabStatusChanged(z: unknown): void; - onUserOnlineStatusChanged(z: unknown): void; + onUserOnlineStatusChanged(z: unknown): void; - onUserTabStatusChanged(arrayList: unknown): void; + onUserTabStatusChanged(arrayList: unknown): void; - onlineStatusBigIconDownloadPush(i2: unknown, j2: unknown, str: unknown): void; + onlineStatusBigIconDownloadPush(i2: unknown, j2: unknown, str: unknown): void; - onlineStatusSmallIconDownloadPush(i2: unknown, j2: unknown, str: unknown): void; + onlineStatusSmallIconDownloadPush(i2: unknown, j2: unknown, str: unknown): void; - // 第一次发现于Linux - onUserSecQualityChanged(...args: unknown[]): void; + // 第一次发现于Linux + onUserSecQualityChanged(...args: unknown[]): void; - onMsgWithRichLinkInfoUpdate(...args: unknown[]): void; + onMsgWithRichLinkInfoUpdate(...args: unknown[]): void; - onRedTouchChanged(...args: unknown[]): void; + onRedTouchChanged(...args: unknown[]): void; - // 第一次发现于Win 9.9.9 23159 - onBroadcastHelperProgerssUpdate(...args: unknown[]): void; + // 第一次发现于Win 9.9.9 23159 + onBroadcastHelperProgerssUpdate(...args: unknown[]): void; } export interface NodeIKernelMsgListener extends IKernelMsgListener { - // eslint-disable-next-line @typescript-eslint/no-misused-new - new(listener: IKernelMsgListener): NodeIKernelMsgListener; + // eslint-disable-next-line @typescript-eslint/no-misused-new + new(listener: IKernelMsgListener): NodeIKernelMsgListener; } @@ -505,6 +508,7 @@ export class MsgListener implements IKernelMsgListener { onRedTouchChanged(...args: unknown[]) { } + // 第一次发现于Win 9.9.9-23159 onBroadcastHelperProgerssUpdate(...args: unknown[]) { diff --git a/src/core/listeners/NodeIKernelProfileListener.ts b/src/core/listeners/NodeIKernelProfileListener.ts index 79c60543..f11fe151 100644 --- a/src/core/listeners/NodeIKernelProfileListener.ts +++ b/src/core/listeners/NodeIKernelProfileListener.ts @@ -1,26 +1,29 @@ import { User, UserDetailInfoListenerArg } from '@/core/entities'; interface IProfileListener { - onProfileSimpleChanged(...args: unknown[]): void; - onUserDetailInfoChanged(arg: UserDetailInfoListenerArg): void; - onProfileDetailInfoChanged(profile: User): void; + onProfileSimpleChanged(...args: unknown[]): void; - onStatusUpdate(...args: unknown[]): void; + onUserDetailInfoChanged(arg: UserDetailInfoListenerArg): void; - onSelfStatusChanged(...args: unknown[]): void; + onProfileDetailInfoChanged(profile: User): void; - onStrangerRemarkChanged(...args: unknown[]): void; + onStatusUpdate(...args: unknown[]): void; + + onSelfStatusChanged(...args: unknown[]): void; + + onStrangerRemarkChanged(...args: unknown[]): void; } export interface NodeIKernelProfileListener extends IProfileListener { - // eslint-disable-next-line @typescript-eslint/no-misused-new - new(listener: IProfileListener): NodeIKernelProfileListener; + // eslint-disable-next-line @typescript-eslint/no-misused-new + new(listener: IProfileListener): NodeIKernelProfileListener; } export class ProfileListener implements IProfileListener { onUserDetailInfoChanged(arg: UserDetailInfoListenerArg): void { - + } + onProfileSimpleChanged(...args: unknown[]) { } diff --git a/src/core/listeners/NodeIKernelRecentContactListener.ts b/src/core/listeners/NodeIKernelRecentContactListener.ts index aed6092d..f4f13a5b 100644 --- a/src/core/listeners/NodeIKernelRecentContactListener.ts +++ b/src/core/listeners/NodeIKernelRecentContactListener.ts @@ -18,15 +18,15 @@ export interface NodeIKernelRecentContactListener extends IKernelRecentContactLi } export class KernelRecentContactListener implements IKernelRecentContactListener { - onDeletedContactsNotify(...args: unknown[]) { + onDeletedContactsNotify(...args: unknown[]) { } - onRecentContactNotification(...args: unknown[]) { + onRecentContactNotification(...args: unknown[]) { } - onMsgUnreadCountUpdate(...args: unknown[]) { + onMsgUnreadCountUpdate(...args: unknown[]) { } @@ -34,11 +34,11 @@ export class KernelRecentContactListener implements IKernelRecentContactListener } - onRecentContactListChanged(...args: unknown[]) { + onRecentContactListChanged(...args: unknown[]) { } - onRecentContactListChangedVer2(...args: unknown[]) { + onRecentContactListChangedVer2(...args: unknown[]) { } } diff --git a/src/core/listeners/NodeIKernelRobotListener.ts b/src/core/listeners/NodeIKernelRobotListener.ts index 9c319fee..75c3f0aa 100644 --- a/src/core/listeners/NodeIKernelRobotListener.ts +++ b/src/core/listeners/NodeIKernelRobotListener.ts @@ -1,5 +1,3 @@ - - export interface IKernelRobotListener { onRobotFriendListChanged(...args: unknown[]): void; @@ -14,15 +12,15 @@ export interface NodeIKernelRobotListener extends IKernelRobotListener { } export class KernelRobotListener implements IKernelRobotListener { - onRobotFriendListChanged(...args: unknown[]){ + onRobotFriendListChanged(...args: unknown[]) { } - onRobotListChanged(...args: unknown[]){ + onRobotListChanged(...args: unknown[]) { } - onRobotProfileChanged(...args: unknown[]){ - + onRobotProfileChanged(...args: unknown[]) { + } } diff --git a/src/core/listeners/NodeIKernelSessionListener.ts b/src/core/listeners/NodeIKernelSessionListener.ts index fa07dfee..a3edabc9 100644 --- a/src/core/listeners/NodeIKernelSessionListener.ts +++ b/src/core/listeners/NodeIKernelSessionListener.ts @@ -1,20 +1,20 @@ export interface ISessionListener { - onNTSessionCreate(args: unknown): void; + onNTSessionCreate(args: unknown): void; - onGProSessionCreate(args: unknown): void; + onGProSessionCreate(args: unknown): void; - onSessionInitComplete(args: unknown): void; + onSessionInitComplete(args: unknown): void; - onOpentelemetryInit(args: unknown): void; + onOpentelemetryInit(args: unknown): void; - onUserOnlineResult(args: unknown): void; + onUserOnlineResult(args: unknown): void; - onGetSelfTinyId(args: unknown): void; + onGetSelfTinyId(args: unknown): void; } export interface NodeIKernelSessionListener extends ISessionListener { - // eslint-disable-next-line @typescript-eslint/no-misused-new - new(adapter: ISessionListener): NodeIKernelSessionListener; + // eslint-disable-next-line @typescript-eslint/no-misused-new + new(adapter: ISessionListener): NodeIKernelSessionListener; } export class SessionListener implements ISessionListener { diff --git a/src/core/listeners/NodeIKernelStorageCleanListener.ts b/src/core/listeners/NodeIKernelStorageCleanListener.ts index ed872d88..c418e030 100644 --- a/src/core/listeners/NodeIKernelStorageCleanListener.ts +++ b/src/core/listeners/NodeIKernelStorageCleanListener.ts @@ -10,6 +10,7 @@ export interface IStorageCleanListener { onChatCleanDone(args: unknown): void; } + export interface NodeIKernelStorageCleanListener extends IStorageCleanListener { // eslint-disable-next-line @typescript-eslint/no-misused-new new(adapter: IStorageCleanListener): NodeIKernelStorageCleanListener; @@ -27,6 +28,7 @@ export class StorageCleanListener implements IStorageCleanListener { onCleanCacheStorageChanged(args: unknown) { } + onFinishScan(args: unknown) { } @@ -34,4 +36,4 @@ export class StorageCleanListener implements IStorageCleanListener { onChatCleanDone(args: unknown) { } -} \ No newline at end of file +} diff --git a/src/core/listeners/NodeIKernelTicketListener.ts b/src/core/listeners/NodeIKernelTicketListener.ts index 1fe32a15..312deb3f 100644 --- a/src/core/listeners/NodeIKernelTicketListener.ts +++ b/src/core/listeners/NodeIKernelTicketListener.ts @@ -1,9 +1,10 @@ export interface IKernelTicketListener { } + export interface NodeIKernelTicketListener extends IKernelTicketListener { // eslint-disable-next-line @typescript-eslint/no-misused-new new(adapter: IKernelTicketListener): NodeIKernelTicketListener; } export class KernelTicketListener implements IKernelTicketListener { -} \ No newline at end of file +} diff --git a/src/core/listeners/index.ts b/src/core/listeners/index.ts index 1d06ea02..ad8c7ca1 100644 --- a/src/core/listeners/index.ts +++ b/src/core/listeners/index.ts @@ -1,4 +1,3 @@ - export * from './NodeIKernelSessionListener'; export * from './NodeIKernelLoginListener'; export * from './NodeIKernelMsgListener'; diff --git a/src/core/services/NodeIKernelAlbumService.ts b/src/core/services/NodeIKernelAlbumService.ts index 651f764b..b8224e0f 100644 --- a/src/core/services/NodeIKernelAlbumService.ts +++ b/src/core/services/NodeIKernelAlbumService.ts @@ -42,5 +42,5 @@ export interface NodeIKernelAlbumService { doQunLike(...args: any[]): unknown;// needs 5 arguments getRedPoints(...args: any[]): unknown;// needs 3 arguments - -} \ No newline at end of file + +} diff --git a/src/core/services/NodeIKernelAvatarService.ts b/src/core/services/NodeIKernelAvatarService.ts index e8541846..1dcc4453 100644 --- a/src/core/services/NodeIKernelAvatarService.ts +++ b/src/core/services/NodeIKernelAvatarService.ts @@ -4,7 +4,7 @@ export interface NodeIKernelAvatarService { removeAvatarListener(arg: unknown): unknown; getAvatarPath(arg1: unknown, arg2: unknown): unknown; - + forceDownloadAvatar(uid: string, useCache: number): Promise; getGroupAvatarPath(arg1: unknown, arg2: unknown): unknown; @@ -28,4 +28,4 @@ export interface NodeIKernelAvatarService { forceDownloadAvatarByUin(arg1: unknown, arg2: unknown): unknown; isNull(): boolean; -} \ No newline at end of file +} diff --git a/src/core/services/NodeIKernelBuddyService.ts b/src/core/services/NodeIKernelBuddyService.ts index 1d28a300..9a58813f 100644 --- a/src/core/services/NodeIKernelBuddyService.ts +++ b/src/core/services/NodeIKernelBuddyService.ts @@ -1,128 +1,131 @@ -import { Friend } from '@/core/entities'; import { GeneralCallResult } from '@/core/services/common'; import { NodeIKernelBuddyListener } from '@/core/listeners'; + export enum BuddyListReqType { - KNOMAL, - KLETTER + KNOMAL, + KLETTER } + export interface NodeIKernelBuddyService { - // 26702 以上 - getBuddyListV2(callFrom: string, reqType: BuddyListReqType): Promise - }> - }>; - //26702 以上 - getBuddyListFromCache(callFrom: string): Promise//Uids - }>>; - // 以下为原生方法 - addKernelBuddyListener(listener: NodeIKernelBuddyListener): number; + // 26702 以上 + getBuddyListV2(callFrom: string, reqType: BuddyListReqType): Promise + }> + }>; - getAllBuddyCount(): number; + //26702 以上 + getBuddyListFromCache(callFrom: string): Promise//Uids + }>>; - removeKernelBuddyListener(listener: unknown): void; + // 以下为原生方法 + addKernelBuddyListener(listener: NodeIKernelBuddyListener): number; - /** - * @deprecated - * @param nocache 使用缓存 - */ - getBuddyList(nocache: boolean): Promise; + getAllBuddyCount(): number; - getBuddyNick(uid: number): string; + removeKernelBuddyListener(listener: unknown): void; - getBuddyRemark(uid: number): string; + /** + * @deprecated + * @param nocache 使用缓存 + */ + getBuddyList(nocache: boolean): Promise; - setBuddyRemark(uid: number, remark: string): void; + getBuddyNick(uid: number): string; - getAvatarUrl(uid: number): string; + getBuddyRemark(uid: number): string; - isBuddy(uid: string): boolean; + setBuddyRemark(uid: number, remark: string): void; - getCategoryNameWithUid(uid: number): string; + getAvatarUrl(uid: number): string; - getTargetBuddySetting(uid: number): unknown; + isBuddy(uid: string): boolean; - getTargetBuddySettingByType(uid: number, type: number): unknown; + getCategoryNameWithUid(uid: number): string; - getBuddyReqUnreadCnt(): number; + getTargetBuddySetting(uid: number): unknown; - getBuddyReq(): unknown; + getTargetBuddySettingByType(uid: number, type: number): unknown; - delBuddyReq(uid: number): void; + getBuddyReqUnreadCnt(): number; - clearBuddyReqUnreadCnt(): void; + getBuddyReq(): unknown; - reqToAddFriends(uid: number, msg: string): void; + delBuddyReq(uid: number): void; - setSpacePermission(uid: number, permission: number): void; + clearBuddyReqUnreadCnt(): void; - approvalFriendRequest(arg: { - friendUid: string; - reqTime: string; - accept: boolean; - }): Promise; + reqToAddFriends(uid: number, msg: string): void; - delBuddy(uid: number): void; + setSpacePermission(uid: number, permission: number): void; - delBatchBuddy(uids: number[]): void; + approvalFriendRequest(arg: { + friendUid: string; + reqTime: string; + accept: boolean; + }): Promise; - getSmartInfos(uid: number): unknown; + delBuddy(uid: number): void; - setBuddyCategory(uid: number, category: number): void; + delBatchBuddy(uids: number[]): void; - setBatchBuddyCategory(uids: number[], category: number): void; + getSmartInfos(uid: number): unknown; - addCategory(category: string): void; + setBuddyCategory(uid: number, category: number): void; - delCategory(category: string): void; + setBatchBuddyCategory(uids: number[], category: number): void; - renameCategory(oldCategory: string, newCategory: string): void; + addCategory(category: string): void; - resortCategory(categorys: string[]): void; + delCategory(category: string): void; - pullCategory(uid: number, category: string): void; + renameCategory(oldCategory: string, newCategory: string): void; - setTop(uid: number, isTop: boolean): void; + resortCategory(categorys: string[]): void; - SetSpecialCare(uid: number, isSpecialCare: boolean): void; + pullCategory(uid: number, category: string): void; - setMsgNotify(uid: number, isNotify: boolean): void; + setTop(uid: number, isTop: boolean): void; - hasBuddyList(): boolean; + SetSpecialCare(uid: number, isSpecialCare: boolean): void; - setBlock(uid: number, isBlock: boolean): void; + setMsgNotify(uid: number, isNotify: boolean): void; - isBlocked(uid: number): boolean; + hasBuddyList(): boolean; - modifyAddMeSetting(setting: unknown): void; + setBlock(uid: number, isBlock: boolean): void; - getAddMeSetting(): unknown; + isBlocked(uid: number): boolean; - getDoubtBuddyReq(): unknown; + modifyAddMeSetting(setting: unknown): void; - getDoubtBuddyUnreadNum(): number; + getAddMeSetting(): unknown; - approvalDoubtBuddyReq(uid: number, isAgree: boolean): void; + getDoubtBuddyReq(): unknown; - delDoubtBuddyReq(uid: number): void; + getDoubtBuddyUnreadNum(): number; - delAllDoubtBuddyReq(): void; + approvalDoubtBuddyReq(uid: number, isAgree: boolean): void; - reportDoubtBuddyReqUnread(): void; + delDoubtBuddyReq(uid: number): void; - getBuddyRecommendContactArkJson(uid: string, phoneNumber: string): Promise; + delAllDoubtBuddyReq(): void; - isNull(): boolean; + reportDoubtBuddyReqUnread(): void; + + getBuddyRecommendContactArkJson(uid: string, phoneNumber: string): Promise; + + isNull(): boolean; } diff --git a/src/core/services/NodeIKernelCollectionService.ts b/src/core/services/NodeIKernelCollectionService.ts index 74ed399f..c745a93a 100644 --- a/src/core/services/NodeIKernelCollectionService.ts +++ b/src/core/services/NodeIKernelCollectionService.ts @@ -1,4 +1,4 @@ -import { GeneralCallResult } from "./common"; +import { GeneralCallResult } from './common'; export interface NodeIKernelCollectionService { addKernelCollectionListener(...args: any[]): unknown;//needs 1 arguments @@ -14,45 +14,45 @@ export interface NodeIKernelCollectionService { count: number, searchDown: boolean }): Promise, - hasMore: boolean, - bottomTimeStamp: string + status: number, + author: { + type: number, + numId: string, + strId: string, + groupId: string, + groupName: string, + uid: string + }, + bid: number, + category: number, + createTime: string, + collectTime: string, + modifyTime: string, + sequence: string, + shareUrl: string, + customGroupId: number, + securityBeat: boolean, + summary: { + textSummary: unknown, + linkSummary: unknown, + gallerySummary: unknown, + audioSummary: unknown, + videoSummary: unknown, + fileSummary: unknown, + locationSummary: unknown, + richMediaSummary: unknown, + } + }>, + hasMore: boolean, + bottomTimeStamp: string + } } - } >;//needs 1 arguments getCollectionContent(...args: any[]): unknown;//needs 5 arguments @@ -88,4 +88,4 @@ export interface NodeIKernelCollectionService { editCollectionItemAfterFastUpload(...args: any[]): unknown;//needs 2 arguments createNewCollectionItem(...args: any[]): unknown;//needs 1 arguments -} \ No newline at end of file +} diff --git a/src/core/services/NodeIKernelDbToolsService.ts b/src/core/services/NodeIKernelDbToolsService.ts index 7c2b3ceb..ab110b05 100644 --- a/src/core/services/NodeIKernelDbToolsService.ts +++ b/src/core/services/NodeIKernelDbToolsService.ts @@ -1,5 +1,7 @@ export interface NodeIKernelDbToolsService { - depositDatabase(...args: unknown[]): unknown; - backupDatabase(...args: unknown[]): unknown; - retrieveDatabase(...args: unknown[]): unknown; + depositDatabase(...args: unknown[]): unknown; + + backupDatabase(...args: unknown[]): unknown; + + retrieveDatabase(...args: unknown[]): unknown; } diff --git a/src/core/services/NodeIKernelECDHService.ts b/src/core/services/NodeIKernelECDHService.ts index 8196b269..e6e83613 100644 --- a/src/core/services/NodeIKernelECDHService.ts +++ b/src/core/services/NodeIKernelECDHService.ts @@ -1,3 +1,3 @@ -export interface NodeIKernelECDHService{ - -} \ No newline at end of file +export interface NodeIKernelECDHService { + +} diff --git a/src/core/services/NodeIKernelGroupService.ts b/src/core/services/NodeIKernelGroupService.ts index e73c5814..2ddbd4c0 100644 --- a/src/core/services/NodeIKernelGroupService.ts +++ b/src/core/services/NodeIKernelGroupService.ts @@ -11,239 +11,254 @@ import { GeneralCallResult } from '@/core/services/common'; //高版本的接口不应该随意使用 使用应该严格进行pr审核 同时部分ipc中未出现的接口不要过于依赖 应该做好数据兜底 export interface NodeIKernelGroupService { - getMemberCommonInfo(Req: { - groupCode: string, - startUin: string, - identifyFlag: string, - uinList: string[], - memberCommonFilter: { - memberUin: number, - uinFlag: number, - uinFlagExt: number, - uinMobileFlag: number, - shutUpTime: number, - privilege: number, - }, - memberNum: number, - filterMethod: string, - onlineFlag: string, - realSpecialTitleFlag: number - }): Promise; - //26702 - getGroupMemberLevelInfo(groupCode: string): Promise; - //26702 - getGroupHonorList(groupCodes: Array): unknown; - - getUinByUids(uins: string[]): Promise<{ - errCode: number, - errMsg: string, - uins: Map - }>; - - getUidByUins(uins: string[]): Promise<{ - errCode: number, - errMsg: string, - uids: Map - }>; - //26702(其实更早 但是我不知道) - checkGroupMemberCache(arrayList: Array): Promise; - - //26702(其实更早 但是我不知道) - getGroupLatestEssenceList(groupCode: string): Promise; - - //26702(其实更早 但是我不知道) - shareDigest(Req: { - appId: string, - appType: number, - msgStyle: number, - recvUin: string, - sendType: number, - clientInfo: { - platform: number - }, - richMsg: { - usingArk: boolean, - title: string, - summary: string, - url: string, - pictureUrl: string, - brief: string - } - }): 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, - result: { - ids: Array<{ - uid: string, - index: number//0 - }>, - infos: {}, - finish: true, - hasRobot: false - } - }>; - - setHeader(uid: string, path: string): unknown; - - addKernelGroupListener(listener: NodeIKernelGroupListener): number; - - removeKernelGroupListener(listenerId: unknown): void; - - createMemberListScene(groupCode: string, scene: string): string; - - destroyMemberListScene(SceneId:string): void; - //About Arg (a) name: lastId 根据手Q来看为object {index:?(number),uid:string} - getNextMemberList(sceneId: string, a: undefined, num: number): Promise<{ - errCode: number, errMsg: string, - result: { ids: string[], infos: Map, finish: boolean, hasRobot: boolean } - }>; - - getPrevMemberList(): unknown; - - monitorMemberList(): unknown; - - searchMember(sceneId: string, keywords: string[]): unknown; - - 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; - - modifyMemberCardName(groupCode: string, uid: string, cardName: string): void; - - getTransferableMemberInfo(groupCode: string): unknown;//获取整个群的 - - transferGroup(uid: string): void; - - getGroupList(force: boolean): Promise; - - getGroupExtList(force: boolean): Promise; - - getGroupDetailInfo(groupCode: string): unknown; - - getMemberExtInfo(param: GroupExtParam): Promise;//req - - getGroupAllInfo(): unknown; - - getDiscussExistInfo(): unknown; - - getGroupConfMember(): unknown; - - getGroupMsgMask(): unknown; - - getGroupPortrait(): void; - - modifyGroupName(groupCode: string, groupName: string, arg: false): void; - - modifyGroupRemark(groupCode: string, remark: string): void; - - modifyGroupDetailInfo(groupCode: string, arg: unknown): void; - - setGroupMsgMask(groupCode: string, arg: unknown): void; - - changeGroupShieldSettingTemp(groupCode: string, arg: unknown): void; - - inviteToGroup(arg: unknown): void; - - inviteMembersToGroup(args: unknown[]): void; - - inviteMembersToGroupWithMsg(args: unknown): void; - - createGroup(arg: unknown): void; - - createGroupWithMembers(arg: unknown): void; - - quitGroup(groupCode: string): void; - - destroyGroup(groupCode: string): void; - //获取单屏群通知列表 - getSingleScreenNotifies(force: boolean, start_seq: string, num: number): Promise; - - clearGroupNotifies(groupCode: string): void; - - getGroupNotifiesUnreadCount(unknown: boolean): Promise; - - clearGroupNotifiesUnreadCount(groupCode: string): void; - - operateSysNotify( - doubt: boolean, - operateMsg: { - operateType: GroupRequestOperateTypes, // 2 拒绝 - targetMsg: { - seq: string, // 通知序列号 - type: GroupNotifyTypes, + getMemberCommonInfo(Req: { groupCode: string, - postscript: string - } - }): Promise; + startUin: string, + identifyFlag: string, + uinList: string[], + memberCommonFilter: { + memberUin: number, + uinFlag: number, + uinFlagExt: number, + uinMobileFlag: number, + shutUpTime: number, + privilege: number, + }, + memberNum: number, + filterMethod: string, + onlineFlag: string, + realSpecialTitleFlag: number + }): Promise; - setTop(groupCode: string, isTop: boolean): void; + //26702 + getGroupMemberLevelInfo(groupCode: string): Promise; - getGroupBulletin(groupCode: string): unknown; + //26702 + getGroupHonorList(groupCodes: Array): unknown; - deleteGroupBulletin(groupCode: string, seq: string): void; + getUinByUids(uins: string[]): Promise<{ + errCode: number, + errMsg: string, + uins: Map + }>; - publishGroupBulletin(groupCode: string, pskey: string, data: any): Promise; + getUidByUins(uins: string[]): Promise<{ + errCode: number, + errMsg: string, + uids: Map + }>; - publishInstructionForNewcomers(groupCode: string, arg: unknown): void; + //26702(其实更早 但是我不知道) + checkGroupMemberCache(arrayList: Array): Promise; - uploadGroupBulletinPic(groupCode: string, pskey: string, imagePath: string): Promise; + //26702(其实更早 但是我不知道) + getGroupLatestEssenceList(groupCode: string): Promise; - downloadGroupBulletinRichMedia(groupCode: string): unknown; + //26702(其实更早 但是我不知道) + shareDigest(Req: { + appId: string, + appType: number, + msgStyle: number, + recvUin: string, + sendType: number, + clientInfo: { + platform: number + }, + richMsg: { + usingArk: boolean, + title: string, + summary: string, + url: string, + pictureUrl: string, + brief: string + } + }): Promise; - getGroupBulletinList(groupCode: string): unknown; + //26702(其实更早 但是我不知道) + isEssenceMsg(Req: { groupCode: string, msgRandom: number, msgSeq: number }): Promise; - getGroupStatisticInfo(groupCode: string): unknown; + //26702(其实更早 但是我不知道) + queryCachedEssenceMsg(Req: { groupCode: string, msgRandom: number, msgSeq: number }): Promise; - getGroupRemainAtTimes(groupCode: string): number; + //26702(其实更早 但是我不知道) + fetchGroupEssenceList(Req: { + groupCode: string, + pageStart: number, + pageLimit: number + }, Arg: unknown): Promise; - getJoinGroupNoVerifyFlag(groupCode: string): unknown; + //26702 + getAllMemberList(groupCode: string, forceFetch: boolean): Promise<{ + errCode: number, + errMsg: string, + result: { + ids: Array<{ + uid: string, + index: number//0 + }>, + infos: {}, + finish: true, + hasRobot: false + } + }>; - getGroupArkInviteState(groupCode: string): unknown; + setHeader(uid: string, path: string): unknown; - reqToJoinGroup(groupCode: string, arg: unknown): void; + addKernelGroupListener(listener: NodeIKernelGroupListener): number; - setGroupShutUp(groupCode: string, shutUp: boolean): void; + removeKernelGroupListener(listenerId: unknown): void; - getGroupShutUpMemberList(groupCode: string): unknown[]; + createMemberListScene(groupCode: string, scene: string): string; - setMemberShutUp(groupCode: string, memberTimes: { uid: string, timeStamp: number }[]): Promise; + destroyMemberListScene(SceneId: string): void; - getGroupRecommendContactArkJson(groupCode: string): unknown; + //About Arg (a) name: lastId 根据手Q来看为object {index:?(number),uid:string} + getNextMemberList(sceneId: string, a: undefined, num: number): Promise<{ + errCode: number, errMsg: string, + result: { ids: string[], infos: Map, finish: boolean, hasRobot: boolean } + }>; - getJoinGroupLink(groupCode: string): unknown; + getPrevMemberList(): unknown; - modifyGroupExtInfo(groupCode: string, arg: unknown): void; + monitorMemberList(): unknown; - //需要提前判断是否存在 高版本新增 - addGroupEssence(param: { - groupCode: string - msgRandom: number, - msgSeq: number - }): Promise; - //需要提前判断是否存在 高版本新增 - removeGroupEssence(param: { - groupCode: string - msgRandom: number, - msgSeq: number - }): Promise; + searchMember(sceneId: string, keywords: string[]): unknown; - isNull(): boolean; + 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; + + modifyMemberCardName(groupCode: string, uid: string, cardName: string): void; + + getTransferableMemberInfo(groupCode: string): unknown;//获取整个群的 + + transferGroup(uid: string): void; + + getGroupList(force: boolean): Promise; + + getGroupExtList(force: boolean): Promise; + + getGroupDetailInfo(groupCode: string): unknown; + + getMemberExtInfo(param: GroupExtParam): Promise;//req + + getGroupAllInfo(): unknown; + + getDiscussExistInfo(): unknown; + + getGroupConfMember(): unknown; + + getGroupMsgMask(): unknown; + + getGroupPortrait(): void; + + modifyGroupName(groupCode: string, groupName: string, arg: false): void; + + modifyGroupRemark(groupCode: string, remark: string): void; + + modifyGroupDetailInfo(groupCode: string, arg: unknown): void; + + setGroupMsgMask(groupCode: string, arg: unknown): void; + + changeGroupShieldSettingTemp(groupCode: string, arg: unknown): void; + + inviteToGroup(arg: unknown): void; + + inviteMembersToGroup(args: unknown[]): void; + + inviteMembersToGroupWithMsg(args: unknown): void; + + createGroup(arg: unknown): void; + + createGroupWithMembers(arg: unknown): void; + + quitGroup(groupCode: string): void; + + destroyGroup(groupCode: string): void; + + //获取单屏群通知列表 + getSingleScreenNotifies(force: boolean, start_seq: string, num: number): Promise; + + clearGroupNotifies(groupCode: string): void; + + getGroupNotifiesUnreadCount(unknown: boolean): Promise; + + clearGroupNotifiesUnreadCount(groupCode: string): void; + + operateSysNotify( + doubt: boolean, + operateMsg: { + operateType: GroupRequestOperateTypes, // 2 拒绝 + targetMsg: { + seq: string, // 通知序列号 + type: GroupNotifyTypes, + groupCode: string, + postscript: string + } + }): Promise; + + setTop(groupCode: string, isTop: boolean): void; + + getGroupBulletin(groupCode: string): unknown; + + deleteGroupBulletin(groupCode: string, seq: string): void; + + publishGroupBulletin(groupCode: string, pskey: string, data: any): Promise; + + publishInstructionForNewcomers(groupCode: string, arg: unknown): void; + + uploadGroupBulletinPic(groupCode: string, pskey: string, imagePath: string): Promise; + + downloadGroupBulletinRichMedia(groupCode: string): unknown; + + getGroupBulletinList(groupCode: string): unknown; + + getGroupStatisticInfo(groupCode: string): unknown; + + getGroupRemainAtTimes(groupCode: string): number; + + getJoinGroupNoVerifyFlag(groupCode: string): unknown; + + getGroupArkInviteState(groupCode: string): unknown; + + reqToJoinGroup(groupCode: string, arg: unknown): void; + + setGroupShutUp(groupCode: string, shutUp: boolean): void; + + getGroupShutUpMemberList(groupCode: string): unknown[]; + + setMemberShutUp(groupCode: string, memberTimes: { uid: string, timeStamp: number }[]): Promise; + + getGroupRecommendContactArkJson(groupCode: string): unknown; + + getJoinGroupLink(groupCode: string): unknown; + + modifyGroupExtInfo(groupCode: string, arg: unknown): void; + + //需要提前判断是否存在 高版本新增 + addGroupEssence(param: { + groupCode: string + msgRandom: number, + msgSeq: number + }): Promise; + + //需要提前判断是否存在 高版本新增 + removeGroupEssence(param: { + groupCode: string + msgRandom: number, + msgSeq: number + }): Promise; + + isNull(): boolean; } diff --git a/src/core/services/NodeIKernelLoginService.ts b/src/core/services/NodeIKernelLoginService.ts index d3941f6b..930095a9 100644 --- a/src/core/services/NodeIKernelLoginService.ts +++ b/src/core/services/NodeIKernelLoginService.ts @@ -1,82 +1,83 @@ import { NodeIKernelLoginListener } from '@/core/listeners/NodeIKernelLoginListener'; export interface LoginInitConfig { - machineId: ''; - appid: string; - platVer: string; - commonPath: string; - clientVer: string; - hostName: string; + machineId: ''; + appid: string; + platVer: string; + commonPath: string; + clientVer: string; + hostName: string; } export interface passwordLoginRetType { - result: string, - loginErrorInfo: { - step: number; - errMsg: string; - proofWaterUrl: string; - newDevicePullQrCodeSig: string; - jumpUrl: string, - jumpWord: string; - tipsTitle: string; - tipsContent: string; - } + result: string, + loginErrorInfo: { + step: number; + errMsg: string; + proofWaterUrl: string; + newDevicePullQrCodeSig: string; + jumpUrl: string, + jumpWord: string; + tipsTitle: string; + tipsContent: string; + } } export interface passwordLoginArgType { - uin: string; - passwordMd5: string;//passwMD5 - step: number;//猜测是需要二次认证 参数 一次为0 - newDeviceLoginSig: string; - proofWaterSig: string; - proofWaterRand: string; - proofWaterSid: string; + uin: string; + passwordMd5: string;//passwMD5 + step: number;//猜测是需要二次认证 参数 一次为0 + newDeviceLoginSig: string; + proofWaterSig: string; + proofWaterRand: string; + proofWaterSid: string; } export interface LoginListItem { - uin: string; - uid: string; - nickName: string; - faceUrl: string; - facePath: string; - loginType: 1; // 1是二维码登录? - isQuickLogin: boolean; // 是否可以快速登录 - isAutoLogin: boolean; // 是否可以自动登录 + uin: string; + uid: string; + nickName: string; + faceUrl: string; + facePath: string; + loginType: 1; // 1是二维码登录? + isQuickLogin: boolean; // 是否可以快速登录 + isAutoLogin: boolean; // 是否可以自动登录 } -export interface QuickLoginResult{ - result: string - loginErrorInfo: { - step: number, - errMsg: string, - proofWaterUrl: string, - newDevicePullQrCodeSig: string, - jumpUrl: string, - jumpWord: string, - tipsTitle: string, - tipsContent: string - } +export interface QuickLoginResult { + result: string; + loginErrorInfo: { + step: number, + errMsg: string, + proofWaterUrl: string, + newDevicePullQrCodeSig: string, + jumpUrl: string, + jumpWord: string, + tipsTitle: string, + tipsContent: string + }; } export interface NodeIKernelLoginService { - // eslint-disable-next-line @typescript-eslint/no-misused-new - new(): NodeIKernelLoginService; + // eslint-disable-next-line @typescript-eslint/no-misused-new + new(): NodeIKernelLoginService; - addKernelLoginListener(listener: NodeIKernelLoginListener): number; - removeKernelLoginListener(listener: number): void; + addKernelLoginListener(listener: NodeIKernelLoginListener): number; - initConfig(config: LoginInitConfig): void; + removeKernelLoginListener(listener: number): void; - getLoginMiscData(cb: (r: unknown) => void): void; + initConfig(config: LoginInitConfig): void; - getLoginList(): Promise<{ - result: number, // 0是ok - LocalLoginInfoList: LoginListItem[] - }>; + getLoginMiscData(cb: (r: unknown) => void): void; - quickLoginWithUin(uin: string): Promise; + getLoginList(): Promise<{ + result: number, // 0是ok + LocalLoginInfoList: LoginListItem[] + }>; - passwordLogin(param: passwordLoginArgType): Promise; + quickLoginWithUin(uin: string): Promise; - getQRCodePicture(): boolean; + passwordLogin(param: passwordLoginArgType): Promise; + + getQRCodePicture(): boolean; } diff --git a/src/core/services/NodeIKernelMsgBackupService.ts b/src/core/services/NodeIKernelMsgBackupService.ts index aef276fc..e48bea13 100644 --- a/src/core/services/NodeIKernelMsgBackupService.ts +++ b/src/core/services/NodeIKernelMsgBackupService.ts @@ -22,6 +22,6 @@ export interface NodeIKernelMsgBackupService { start(...args: any[]): unknown;// needs 1 arguments stop(...args: any[]): unknown;// needs 1 arguments - + pause(...args: any[]): unknown;// needs 2 arguments -} \ No newline at end of file +} diff --git a/src/core/services/NodeIKernelMsgService.ts b/src/core/services/NodeIKernelMsgService.ts index 61c01d7c..ead24875 100644 --- a/src/core/services/NodeIKernelMsgService.ts +++ b/src/core/services/NodeIKernelMsgService.ts @@ -3,725 +3,742 @@ import { NodeIKernelMsgListener } from '@/core/listeners/NodeIKernelMsgListener' import { GeneralCallResult } from '@/core/services/common'; export interface QueryMsgsParams { - chatInfo: Peer, - filterMsgType: [], - filterSendersUid: string[], - filterMsgFromTime: string, - filterMsgToTime: string, - pageLimit: number, - isReverseOrder: boolean, - isIncludeCurrent: boolean + chatInfo: Peer, + filterMsgType: [], + filterSendersUid: string[], + filterMsgFromTime: string, + filterMsgToTime: string, + pageLimit: number, + isReverseOrder: boolean, + isIncludeCurrent: boolean } + export interface NodeIKernelMsgService { - generateMsgUniqueId(chatType: number, time: string): string; + generateMsgUniqueId(chatType: number, time: string): string; - addKernelMsgListener(nodeIKernelMsgListener: NodeIKernelMsgListener): number; + addKernelMsgListener(nodeIKernelMsgListener: NodeIKernelMsgListener): number; - sendMsg(msgId: string, peer: Peer, msgElements: SendMessageElement[], map: Map): Promise; + sendMsg(msgId: string, peer: Peer, msgElements: SendMessageElement[], map: Map): Promise; - recallMsg(peer: Peer, msgIds: string[]): Promise; + recallMsg(peer: Peer, msgIds: string[]): Promise; - addKernelMsgImportToolListener(arg: Object): unknown; + addKernelMsgImportToolListener(arg: Object): unknown; - removeKernelMsgListener(args: unknown): unknown; + removeKernelMsgListener(args: unknown): unknown; - addKernelTempChatSigListener(...args: unknown[]): unknown; + addKernelTempChatSigListener(...args: unknown[]): unknown; - removeKernelTempChatSigListener(...args: unknown[]): unknown; + removeKernelTempChatSigListener(...args: unknown[]): unknown; - setAutoReplyTextList(AutoReplyText: Array, i2: number): unknown; + setAutoReplyTextList(AutoReplyText: Array, i2: number): unknown; - getAutoReplyTextList(...args: unknown[]): unknown; + getAutoReplyTextList(...args: unknown[]): unknown; - getOnLineDev(): void; + getOnLineDev(): void; - kickOffLine(DevInfo: Object): unknown; + kickOffLine(DevInfo: Object): unknown; - setStatus(args: { status: number, extStatus: number, batteryStatus: number }): Promise; + setStatus(args: { status: number, extStatus: number, batteryStatus: number }): Promise; - fetchStatusMgrInfo(): unknown; + fetchStatusMgrInfo(): unknown; - fetchStatusUnitedConfigInfo(): unknown; + fetchStatusUnitedConfigInfo(): unknown; - getOnlineStatusSmallIconBasePath(): unknown; + getOnlineStatusSmallIconBasePath(): unknown; - getOnlineStatusSmallIconFileNameByUrl(Url: string): unknown; + getOnlineStatusSmallIconFileNameByUrl(Url: string): unknown; - downloadOnlineStatusSmallIconByUrl(arg0: number, arg1: string): unknown; + downloadOnlineStatusSmallIconByUrl(arg0: number, arg1: string): unknown; - getOnlineStatusBigIconBasePath(): unknown; + getOnlineStatusBigIconBasePath(): unknown; - downloadOnlineStatusBigIconByUrl(arg0: number, arg1: string): unknown; + downloadOnlineStatusBigIconByUrl(arg0: number, arg1: string): unknown; - getOnlineStatusCommonPath(arg: string): unknown; + getOnlineStatusCommonPath(arg: string): unknown; - getOnlineStatusCommonFileNameByUrl(Url: string): unknown; + getOnlineStatusCommonFileNameByUrl(Url: string): unknown; - downloadOnlineStatusCommonByUrl(arg0: string, arg1: string): unknown; + downloadOnlineStatusCommonByUrl(arg0: string, arg1: string): unknown; - // this.tokenType = i2; - // this.apnsToken = bArr; - // this.voipToken = bArr2; - // this.profileId = str; + // this.tokenType = i2; + // this.apnsToken = bArr; + // this.voipToken = bArr2; + // this.profileId = str; - setToken(arg: Object): unknown; + setToken(arg: Object): unknown; - switchForeGround(): unknown; + switchForeGround(): unknown; - switchBackGround(arg: Object): unknown; + switchBackGround(arg: Object): unknown; - //hex - setTokenForMqq(token: string): unknown; + //hex + setTokenForMqq(token: string): unknown; - switchForeGroundForMqq(...args: unknown[]): unknown; + switchForeGroundForMqq(...args: unknown[]): unknown; - switchBackGroundForMqq(...args: unknown[]): unknown; + switchBackGroundForMqq(...args: unknown[]): unknown; - getMsgSetting(...args: unknown[]): unknown; + getMsgSetting(...args: unknown[]): unknown; - setMsgSetting(...args: unknown[]): unknown; + setMsgSetting(...args: unknown[]): unknown; - addSendMsg(...args: unknown[]): unknown; + addSendMsg(...args: unknown[]): unknown; - cancelSendMsg(...args: unknown[]): unknown; + cancelSendMsg(...args: unknown[]): unknown; - switchToOfflineSendMsg(peer: Peer, MsgId: string): unknown; + switchToOfflineSendMsg(peer: Peer, MsgId: string): unknown; - reqToOfflineSendMsg(...args: unknown[]): unknown; + reqToOfflineSendMsg(...args: unknown[]): unknown; - refuseReceiveOnlineFileMsg(peer: Peer, MsgId: string): unknown; + refuseReceiveOnlineFileMsg(peer: Peer, MsgId: string): unknown; - resendMsg(...args: unknown[]): unknown; + resendMsg(...args: unknown[]): unknown; - recallMsg(...args: unknown[]): unknown; + recallMsg(...args: unknown[]): unknown; - reeditRecallMsg(...args: unknown[]): unknown; + reeditRecallMsg(...args: unknown[]): unknown; - forwardMsg(...args: unknown[]): Promise; + forwardMsg(...args: unknown[]): Promise; - forwardMsgWithComment(...args: unknown[]): unknown; + forwardMsgWithComment(...args: unknown[]): unknown; - forwardSubMsgWithComment(...args: unknown[]): unknown; + forwardSubMsgWithComment(...args: unknown[]): unknown; - forwardRichMsgInVist(...args: unknown[]): unknown; + forwardRichMsgInVist(...args: unknown[]): unknown; - forwardFile(...args: unknown[]): unknown; - //Array, Peer from, Peer to - multiForwardMsg(...args: unknown[]): unknown; + forwardFile(...args: unknown[]): unknown; - multiForwardMsgWithComment(...args: unknown[]): unknown; + //Array, Peer from, Peer to + multiForwardMsg(...args: unknown[]): unknown; - deleteRecallMsg(...args: unknown[]): unknown; + multiForwardMsgWithComment(...args: unknown[]): unknown; - deleteRecallMsgForLocal(...args: unknown[]): unknown; + deleteRecallMsg(...args: unknown[]): unknown; - addLocalGrayTipMsg(...args: unknown[]): unknown; + deleteRecallMsgForLocal(...args: unknown[]): unknown; - addLocalJsonGrayTipMsg(...args: unknown[]): unknown; + addLocalGrayTipMsg(...args: unknown[]): unknown; - addLocalJsonGrayTipMsgExt(...args: unknown[]): unknown; + addLocalJsonGrayTipMsg(...args: unknown[]): unknown; - IsLocalJsonTipValid(...args: unknown[]): unknown; + addLocalJsonGrayTipMsgExt(...args: unknown[]): unknown; - addLocalAVRecordMsg(...args: unknown[]): unknown; + IsLocalJsonTipValid(...args: unknown[]): unknown; - addLocalTofuRecordMsg(...args: unknown[]): unknown; + addLocalAVRecordMsg(...args: unknown[]): unknown; - addLocalRecordMsg(Peer: Peer, msgId: string, ele: MessageElement, attr: Array | number, front: boolean): Promise; + addLocalTofuRecordMsg(...args: unknown[]): unknown; - deleteMsg(Peer: Peer, msgIds: Array): Promise; + addLocalRecordMsg(Peer: Peer, msgId: string, ele: MessageElement, attr: Array | number, front: boolean): Promise; - updateElementExtBufForUI(...args: unknown[]): unknown; + deleteMsg(Peer: Peer, msgIds: Array): Promise; - updateMsgRecordExtPbBufForUI(...args: unknown[]): unknown; + updateElementExtBufForUI(...args: unknown[]): unknown; - startMsgSync(...args: unknown[]): unknown; + updateMsgRecordExtPbBufForUI(...args: unknown[]): unknown; - startGuildMsgSync(...args: unknown[]): unknown; + startMsgSync(...args: unknown[]): unknown; - isGuildChannelSync(...args: unknown[]): unknown; + startGuildMsgSync(...args: unknown[]): unknown; - getMsgUniqueId(UniqueId: string): string; + isGuildChannelSync(...args: unknown[]): unknown; - isMsgMatched(...args: unknown[]): unknown; + getMsgUniqueId(UniqueId: string): string; - getOnlineFileMsgs(...args: unknown[]): unknown; + isMsgMatched(...args: unknown[]): unknown; - getAllOnlineFileMsgs(...args: unknown[]): unknown; + getOnlineFileMsgs(...args: unknown[]): unknown; - getLatestDbMsgs(peer: Peer, cnt: number): Promise; + getAllOnlineFileMsgs(...args: unknown[]): unknown; - getLastMessageList(peer: Peer[]): Promise; + getLatestDbMsgs(peer: Peer, cnt: number): Promise; - getAioFirstViewLatestMsgs(peer: Peer, num: number): unknown; + getLastMessageList(peer: Peer[]): Promise; - getMsgs(peer: Peer, msgId: string, count: unknown, queryOrder: boolean): Promise; + getAioFirstViewLatestMsgs(peer: Peer, num: number): unknown; - getMsgsIncludeSelf(peer: Peer, msgId: string, count: number, queryOrder: boolean): Promise; + getMsgs(peer: Peer, msgId: string, count: unknown, queryOrder: boolean): Promise; - // this.$peer = contact; - // this.$msgTime = j2; - // this.$clientSeq = j3; - // this.$cnt = i2; + getMsgsIncludeSelf(peer: Peer, msgId: string, count: number, queryOrder: boolean): Promise; - getMsgsWithMsgTimeAndClientSeqForC2C(...args: unknown[]): Promise; + // this.$peer = contact; + // this.$msgTime = j2; + // this.$clientSeq = j3; + // this.$cnt = i2; - getMsgsWithStatus(params: { - peer: Peer - msgId: string - msgTime: unknown - cnt: unknown - queryOrder: boolean - isIncludeSelf: boolean - appid: unknown - }): Promise; + getMsgsWithMsgTimeAndClientSeqForC2C(...args: unknown[]): Promise; - getMsgsBySeqRange(peer: Peer, startSeq: string, endSeq: string): Promise; + getMsgsWithStatus(params: { + peer: Peer + msgId: string + msgTime: unknown + cnt: unknown + queryOrder: boolean + isIncludeSelf: boolean + appid: unknown + }): Promise; - getMsgsBySeqAndCount(peer: Peer, seq: string, count: number, desc: boolean, unknownArg: boolean): Promise; + getMsgsBySeqRange(peer: Peer, startSeq: string, endSeq: string): Promise; - getMsgsByMsgId(peer: Peer, ids: string[]): Promise; + getMsgsBySeqAndCount(peer: Peer, seq: string, count: number, desc: boolean, unknownArg: boolean): Promise; - getRecallMsgsByMsgId(peer: Peer, MsgId: string[]): Promise; + getMsgsByMsgId(peer: Peer, ids: string[]): Promise; - getMsgsBySeqList(peer: Peer, seqList: string[]): Promise; + getRecallMsgsByMsgId(peer: Peer, MsgId: string[]): Promise; - getSingleMsg(Peer: Peer, msgSeq: string): Promise; + getMsgsBySeqList(peer: Peer, seqList: string[]): Promise; - getSourceOfReplyMsg(peer: Peer, MsgId: string, SourceSeq: string): unknown; + getSingleMsg(Peer: Peer, msgSeq: string): Promise; - getSourceOfReplyMsgV2(peer: Peer, RootMsgId: string, ReplyMsgId: string): unknown; + getSourceOfReplyMsg(peer: Peer, MsgId: string, SourceSeq: string): unknown; - getMsgByClientSeqAndTime(peer: Peer, clientSeq: string, time: string): unknown; + getSourceOfReplyMsgV2(peer: Peer, RootMsgId: string, ReplyMsgId: string): unknown; - getSourceOfReplyMsgByClientSeqAndTime(peer: Peer, clientSeq: string, time: string): unknown; - //cnt clientSeq?并不是吧 - getMsgsByTypeFilter(peer: Peer, msgId: string, cnt: unknown, queryOrder: boolean, typeFilter: { type: number, subtype: Array }): unknown; + getMsgByClientSeqAndTime(peer: Peer, clientSeq: string, time: string): unknown; - getMsgsByTypeFilters(peer: Peer, msgId: string, cnt: unknown, queryOrder: boolean, typeFilters: Array<{ type: number, subtype: Array }>): unknown; + getSourceOfReplyMsgByClientSeqAndTime(peer: Peer, clientSeq: string, time: string): unknown; - getMsgWithAbstractByFilterParam(...args: unknown[]): unknown; + //cnt clientSeq?并不是吧 + getMsgsByTypeFilter(peer: Peer, msgId: string, cnt: unknown, queryOrder: boolean, typeFilter: { + type: number, + subtype: Array + }): unknown; - queryMsgsWithFilter(...args: unknown[]): unknown; + getMsgsByTypeFilters(peer: Peer, msgId: string, cnt: unknown, queryOrder: boolean, typeFilters: Array<{ + type: number, + subtype: Array + }>): unknown; - /** - * @deprecated 该函数已被标记为废弃,请使用新的替代方法。 - * 使用过滤条件查询消息列表的版本2接口。 - * - * 该函数通过一系列过滤条件来查询特定聊天中的消息列表。这些条件包括消息类型、发送者、时间范围等。 - * 函数返回一个Promise,解析为查询结果的未知类型对象。 - * - * @param MsgId 消息ID,用于特定消息的查询。 - * @param MsgTime 消息时间,用于指定消息的时间范围。 - * @param param 查询参数对象,包含详细的过滤条件和分页信息。 - * @param param.chatInfo 聊天信息,包括聊天类型和对方用户ID。 - * @param param.filterMsgType 需要过滤的消息类型数组,留空表示不过滤。 - * @param param.filterSendersUid 需要过滤的发送者用户ID数组。 - * @param param.filterMsgFromTime 查询消息的起始时间。 - * @param param.filterMsgToTime 查询消息的结束时间。 - * @param param.pageLimit 每页的消息数量限制。 - * @param param.isReverseOrder 是否按时间顺序倒序返回消息。 - * @param param.isIncludeCurrent 是否包含当前页码。 - * @returns 返回一个Promise,解析为查询结果的未知类型对象。 - */ - queryMsgsWithFilterVer2(MsgId: string, MsgTime: string, param: QueryMsgsParams): Promise; + getMsgWithAbstractByFilterParam(...args: unknown[]): unknown; - // this.chatType = i2; - // this.peerUid = str; + queryMsgsWithFilter(...args: unknown[]): unknown; - // this.chatInfo = new ChatInfo(); - // this.filterMsgType = new ArrayList<>(); - // this.filterSendersUid = new ArrayList<>(); - // this.chatInfo = chatInfo; - // this.filterMsgType = arrayList; - // this.filterSendersUid = arrayList2; - // this.filterMsgFromTime = j2; - // this.filterMsgToTime = j3; - // this.pageLimit = i2; - // this.isReverseOrder = z; - // this.isIncludeCurrent = z2; - //queryMsgsWithFilterEx(0L, 0L, 0L, new QueryMsgsParams(new ChatInfo(2, str), new ArrayList(), new ArrayList(), 0L, 0L, 250, false, true)) - queryMsgsWithFilterEx(msgId: string, msgTime: string, megSeq: string, param: QueryMsgsParams): Promise; - //queryMsgsWithFilterEx(this.$msgId, this.$msgTime, this.$msgSeq, this.$param) - queryFileMsgsDesktop(...args: unknown[]): unknown; + /** + * @deprecated 该函数已被标记为废弃,请使用新的替代方法。 + * 使用过滤条件查询消息列表的版本2接口。 + * + * 该函数通过一系列过滤条件来查询特定聊天中的消息列表。这些条件包括消息类型、发送者、时间范围等。 + * 函数返回一个Promise,解析为查询结果的未知类型对象。 + * + * @param MsgId 消息ID,用于特定消息的查询。 + * @param MsgTime 消息时间,用于指定消息的时间范围。 + * @param param 查询参数对象,包含详细的过滤条件和分页信息。 + * @param param.chatInfo 聊天信息,包括聊天类型和对方用户ID。 + * @param param.filterMsgType 需要过滤的消息类型数组,留空表示不过滤。 + * @param param.filterSendersUid 需要过滤的发送者用户ID数组。 + * @param param.filterMsgFromTime 查询消息的起始时间。 + * @param param.filterMsgToTime 查询消息的结束时间。 + * @param param.pageLimit 每页的消息数量限制。 + * @param param.isReverseOrder 是否按时间顺序倒序返回消息。 + * @param param.isIncludeCurrent 是否包含当前页码。 + * @returns 返回一个Promise,解析为查询结果的未知类型对象。 + */ + queryMsgsWithFilterVer2(MsgId: string, MsgTime: string, param: QueryMsgsParams): Promise; - setMsgRichInfoFlag(...args: unknown[]): unknown; + // this.chatType = i2; + // this.peerUid = str; - queryPicOrVideoMsgs(msgId: string, msgTime: string, megSeq: string, param: QueryMsgsParams): Promise; + // this.chatInfo = new ChatInfo(); + // this.filterMsgType = new ArrayList<>(); + // this.filterSendersUid = new ArrayList<>(); + // this.chatInfo = chatInfo; + // this.filterMsgType = arrayList; + // this.filterSendersUid = arrayList2; + // this.filterMsgFromTime = j2; + // this.filterMsgToTime = j3; + // this.pageLimit = i2; + // this.isReverseOrder = z; + // this.isIncludeCurrent = z2; + //queryMsgsWithFilterEx(0L, 0L, 0L, new QueryMsgsParams(new ChatInfo(2, str), new ArrayList(), new ArrayList(), 0L, 0L, 250, false, true)) + queryMsgsWithFilterEx(msgId: string, msgTime: string, megSeq: string, param: QueryMsgsParams): Promise; - queryPicOrVideoMsgsDesktop(...args: unknown[]): unknown; + //queryMsgsWithFilterEx(this.$msgId, this.$msgTime, this.$msgSeq, this.$param) + queryFileMsgsDesktop(...args: unknown[]): unknown; - queryEmoticonMsgs(msgId: string, msgTime: string, msgSeq: string, Params: QueryMsgsParams): Promise; + setMsgRichInfoFlag(...args: unknown[]): unknown; - queryTroopEmoticonMsgs(msgId: string, msgTime: string, msgSeq: string, Params: QueryMsgsParams): Promise; + queryPicOrVideoMsgs(msgId: string, msgTime: string, megSeq: string, param: QueryMsgsParams): Promise; - queryMsgsAndAbstractsWithFilter(msgId: string, msgTime: string, megSeq: string, param: QueryMsgsParams): unknown; + queryPicOrVideoMsgsDesktop(...args: unknown[]): unknown; - setFocusOnGuild(...args: unknown[]): unknown; + queryEmoticonMsgs(msgId: string, msgTime: string, msgSeq: string, Params: QueryMsgsParams): Promise; - setFocusSession(...args: unknown[]): unknown; + queryTroopEmoticonMsgs(msgId: string, msgTime: string, msgSeq: string, Params: QueryMsgsParams): Promise; - enableFilterUnreadInfoNotify(...args: unknown[]): unknown; + queryMsgsAndAbstractsWithFilter(msgId: string, msgTime: string, megSeq: string, param: QueryMsgsParams): unknown; - enableFilterMsgAbstractNotify(...args: unknown[]): unknown; + setFocusOnGuild(...args: unknown[]): unknown; - onScenesChangeForSilenceMode(...args: unknown[]): unknown; + setFocusSession(...args: unknown[]): unknown; - getContactUnreadCnt(...args: unknown[]): unknown; + enableFilterUnreadInfoNotify(...args: unknown[]): unknown; - getUnreadCntInfo(...args: unknown[]): unknown; + enableFilterMsgAbstractNotify(...args: unknown[]): unknown; - getGuildUnreadCntInfo(...args: unknown[]): unknown; + onScenesChangeForSilenceMode(...args: unknown[]): unknown; - getGuildUnreadCntTabInfo(...args: unknown[]): unknown; + getContactUnreadCnt(...args: unknown[]): unknown; - getAllGuildUnreadCntInfo(...args: unknown[]): unknown; + getUnreadCntInfo(...args: unknown[]): unknown; - getAllJoinGuildCnt(...args: unknown[]): unknown; + getGuildUnreadCntInfo(...args: unknown[]): unknown; - getAllDirectSessionUnreadCntInfo(...args: unknown[]): unknown; + getGuildUnreadCntTabInfo(...args: unknown[]): unknown; - getCategoryUnreadCntInfo(...args: unknown[]): unknown; + getAllGuildUnreadCntInfo(...args: unknown[]): unknown; - getGuildFeedsUnreadCntInfo(...args: unknown[]): unknown; + getAllJoinGuildCnt(...args: unknown[]): unknown; - setUnVisibleChannelCntInfo(...args: unknown[]): unknown; + getAllDirectSessionUnreadCntInfo(...args: unknown[]): unknown; - setUnVisibleChannelTypeCntInfo(...args: unknown[]): unknown; + getCategoryUnreadCntInfo(...args: unknown[]): unknown; - setVisibleGuildCntInfo(...args: unknown[]): unknown; + getGuildFeedsUnreadCntInfo(...args: unknown[]): unknown; - setMsgRead(peer: Peer): Promise; + setUnVisibleChannelCntInfo(...args: unknown[]): unknown; - setAllC2CAndGroupMsgRead(): Promise; + setUnVisibleChannelTypeCntInfo(...args: unknown[]): unknown; - setGuildMsgRead(...args: unknown[]): unknown; + setVisibleGuildCntInfo(...args: unknown[]): unknown; - setAllGuildMsgRead(...args: unknown[]): unknown; + setMsgRead(peer: Peer): Promise; - setMsgReadAndReport(...args: unknown[]): unknown; + setAllC2CAndGroupMsgRead(): Promise; - setSpecificMsgReadAndReport(...args: unknown[]): unknown; + setGuildMsgRead(...args: unknown[]): unknown; - setLocalMsgRead(...args: unknown[]): unknown; + setAllGuildMsgRead(...args: unknown[]): unknown; - setGroupGuildMsgRead(...args: unknown[]): unknown; + setMsgReadAndReport(...args: unknown[]): unknown; - getGuildGroupTransData(...args: unknown[]): unknown; + setSpecificMsgReadAndReport(...args: unknown[]): unknown; - setGroupGuildBubbleRead(...args: unknown[]): unknown; + setLocalMsgRead(...args: unknown[]): unknown; - getGuildGroupBubble(...args: unknown[]): unknown; + setGroupGuildMsgRead(...args: unknown[]): unknown; - fetchGroupGuildUnread(...args: unknown[]): unknown; + getGuildGroupTransData(...args: unknown[]): unknown; - setGroupGuildFlag(...args: unknown[]): unknown; + setGroupGuildBubbleRead(...args: unknown[]): unknown; - setGuildUDCFlag(...args: unknown[]): unknown; + getGuildGroupBubble(...args: unknown[]): unknown; - setGuildTabUserFlag(...args: unknown[]): unknown; + fetchGroupGuildUnread(...args: unknown[]): unknown; - setBuildMode(flag: number/*0 1 3*/): unknown; + setGroupGuildFlag(...args: unknown[]): unknown; - setConfigurationServiceData(...args: unknown[]): unknown; + setGuildUDCFlag(...args: unknown[]): unknown; - setMarkUnreadFlag(...args: unknown[]): unknown; + setGuildTabUserFlag(...args: unknown[]): unknown; - getChannelEventFlow(...args: unknown[]): unknown; + setBuildMode(flag: number/*0 1 3*/): unknown; - getMsgEventFlow(...args: unknown[]): unknown; + setConfigurationServiceData(...args: unknown[]): unknown; - getRichMediaFilePathForMobileQQSend(...args: unknown[]): unknown; + setMarkUnreadFlag(...args: unknown[]): unknown; - getRichMediaFilePathForGuild(arg: { - md5HexStr: string, - fileName: string, - elementType: ElementType, - elementSubType: number, - thumbSize: 0, - needCreate: true, - downloadType: 1, - file_uuid: '' - }): string; + getChannelEventFlow(...args: unknown[]): unknown; - assembleMobileQQRichMediaFilePath(...args: unknown[]): unknown; + getMsgEventFlow(...args: unknown[]): unknown; - getFileThumbSavePathForSend(...args: unknown[]): unknown; + getRichMediaFilePathForMobileQQSend(...args: unknown[]): unknown; - getFileThumbSavePath(...args: unknown[]): unknown; - //猜测居多 - translatePtt2Text(MsgId: string, Peer: {}, MsgElement: {}): unknown; + getRichMediaFilePathForGuild(arg: { + md5HexStr: string, + fileName: string, + elementType: ElementType, + elementSubType: number, + thumbSize: 0, + needCreate: true, + downloadType: 1, + file_uuid: '' + }): string; - setPttPlayedState(...args: unknown[]): unknown; - // NodeIQQNTWrapperSession fetchFavEmojiList [ - // "", - // 48, - // true, - // true - // ] - fetchFavEmojiList(str: string, num: number, uk1: boolean, uk2: boolean): Promise - }>; + assembleMobileQQRichMediaFilePath(...args: unknown[]): unknown; - addFavEmoji(...args: unknown[]): unknown; + getFileThumbSavePathForSend(...args: unknown[]): unknown; - fetchMarketEmoticonList(...args: unknown[]): unknown; + getFileThumbSavePath(...args: unknown[]): unknown; - fetchMarketEmoticonShowImage(...args: unknown[]): unknown; + //猜测居多 + translatePtt2Text(MsgId: string, Peer: {}, MsgElement: {}): unknown; - fetchMarketEmoticonAioImage(...args: unknown[]): unknown; + setPttPlayedState(...args: unknown[]): unknown; - fetchMarketEmotionJsonFile(...args: unknown[]): unknown; + // NodeIQQNTWrapperSession fetchFavEmojiList [ + // "", + // 48, + // true, + // true + // ] + fetchFavEmojiList(str: string, num: number, uk1: boolean, uk2: boolean): Promise + }>; - getMarketEmoticonPath(...args: unknown[]): unknown; + addFavEmoji(...args: unknown[]): unknown; - getMarketEmoticonPathBySync(...args: unknown[]): unknown; + fetchMarketEmoticonList(...args: unknown[]): unknown; - fetchMarketEmoticonFaceImages(...args: unknown[]): unknown; + fetchMarketEmoticonShowImage(...args: unknown[]): unknown; - fetchMarketEmoticonAuthDetail(...args: unknown[]): unknown; + fetchMarketEmoticonAioImage(...args: unknown[]): unknown; - getFavMarketEmoticonInfo(...args: unknown[]): unknown; + fetchMarketEmotionJsonFile(...args: unknown[]): unknown; - addRecentUsedFace(...args: unknown[]): unknown; + getMarketEmoticonPath(...args: unknown[]): unknown; - getRecentUsedFaceList(...args: unknown[]): unknown; + getMarketEmoticonPathBySync(...args: unknown[]): unknown; - getMarketEmoticonEncryptKeys(...args: unknown[]): unknown; + fetchMarketEmoticonFaceImages(...args: unknown[]): unknown; - downloadEmojiPic(...args: unknown[]): unknown; + fetchMarketEmoticonAuthDetail(...args: unknown[]): unknown; - deleteFavEmoji(...args: unknown[]): unknown; + getFavMarketEmoticonInfo(...args: unknown[]): unknown; - modifyFavEmojiDesc(...args: unknown[]): unknown; + addRecentUsedFace(...args: unknown[]): unknown; - queryFavEmojiByDesc(...args: unknown[]): unknown; + getRecentUsedFaceList(...args: unknown[]): unknown; - getHotPicInfoListSearchString(...args: unknown[]): unknown; + getMarketEmoticonEncryptKeys(...args: unknown[]): unknown; - getHotPicSearchResult(...args: unknown[]): unknown; + downloadEmojiPic(...args: unknown[]): unknown; - getHotPicHotWords(...args: unknown[]): unknown; + deleteFavEmoji(...args: unknown[]): unknown; - getHotPicJumpInfo(...args: unknown[]): unknown; + modifyFavEmojiDesc(...args: unknown[]): unknown; - getEmojiResourcePath(...args: unknown[]): unknown; + queryFavEmojiByDesc(...args: unknown[]): unknown; - JoinDragonGroupEmoji(JoinDragonGroupEmojiReq: any/*joinDragonGroupEmojiReq*/): unknown; + getHotPicInfoListSearchString(...args: unknown[]): unknown; - getMsgAbstracts(...args: unknown[]): unknown; + getHotPicSearchResult(...args: unknown[]): unknown; - getMsgAbstract(...args: unknown[]): unknown; + getHotPicHotWords(...args: unknown[]): unknown; - getMsgAbstractList(...args: unknown[]): unknown; + getHotPicJumpInfo(...args: unknown[]): unknown; - getMsgAbstractListBySeqRange(...args: unknown[]): unknown; + getEmojiResourcePath(...args: unknown[]): unknown; - refreshMsgAbstracts(...args: unknown[]): unknown; + JoinDragonGroupEmoji(JoinDragonGroupEmojiReq: any/*joinDragonGroupEmojiReq*/): unknown; - refreshMsgAbstractsByGuildIds(...args: unknown[]): unknown; + getMsgAbstracts(...args: unknown[]): unknown; - getRichMediaElement(...args: unknown[]): unknown; + getMsgAbstract(...args: unknown[]): unknown; - cancelGetRichMediaElement(...args: unknown[]): unknown; + getMsgAbstractList(...args: unknown[]): unknown; - refuseGetRichMediaElement(...args: unknown[]): unknown; + getMsgAbstractListBySeqRange(...args: unknown[]): unknown; - switchToOfflineGetRichMediaElement(...args: unknown[]): unknown; + refreshMsgAbstracts(...args: unknown[]): unknown; - downloadRichMedia(...args: unknown[]): unknown; + refreshMsgAbstractsByGuildIds(...args: unknown[]): unknown; - getFirstUnreadMsgSeq(args: { - peerUid: string - guildId: string - }): unknown; + getRichMediaElement(...args: unknown[]): unknown; - getFirstUnreadCommonMsg(...args: unknown[]): unknown; + cancelGetRichMediaElement(...args: unknown[]): unknown; - getFirstUnreadAtmeMsg(...args: unknown[]): unknown; + refuseGetRichMediaElement(...args: unknown[]): unknown; - getFirstUnreadAtallMsg(...args: unknown[]): unknown; + switchToOfflineGetRichMediaElement(...args: unknown[]): unknown; - getNavigateInfo(...args: unknown[]): unknown; + downloadRichMedia(...args: unknown[]): unknown; - getChannelFreqLimitInfo(...args: unknown[]): unknown; + getFirstUnreadMsgSeq(args: { + peerUid: string + guildId: string + }): unknown; - getRecentUseEmojiList(...args: unknown[]): unknown; + getFirstUnreadCommonMsg(...args: unknown[]): unknown; - getRecentEmojiList(...args: unknown[]): unknown; + getFirstUnreadAtmeMsg(...args: unknown[]): unknown; - setMsgEmojiLikes(...args: unknown[]): unknown; + getFirstUnreadAtallMsg(...args: unknown[]): unknown; - getMsgEmojiLikesList(peer: Peer, msgSeq: string, emojiId: string, emojiType: string, cookie: string, bForward: boolean, number: number): Promise<{ - result: number, - errMsg: string, - emojiLikesList: - Array<{ - tinyId: string, - nickName: string, - headUrl: string - }>, - cookie: string, - isLastPage: boolean, - isFirstPage: boolean - }>; + getNavigateInfo(...args: unknown[]): unknown; - setMsgEmojiLikesForRole(...args: unknown[]): unknown; + getChannelFreqLimitInfo(...args: unknown[]): unknown; - clickInlineKeyboardButton(...args: unknown[]): unknown; + getRecentUseEmojiList(...args: unknown[]): unknown; - setCurOnScreenMsg(...args: unknown[]): unknown; + getRecentEmojiList(...args: unknown[]): unknown; - setCurOnScreenMsgForMsgEvent(...args: unknown[]): unknown; + setMsgEmojiLikes(...args: unknown[]): unknown; - getMiscData(key: string): unknown; + getMsgEmojiLikesList(peer: Peer, msgSeq: string, emojiId: string, emojiType: string, cookie: string, bForward: boolean, number: number): Promise<{ + result: number, + errMsg: string, + emojiLikesList: + Array<{ + tinyId: string, + nickName: string, + headUrl: string + }>, + cookie: string, + isLastPage: boolean, + isFirstPage: boolean + }>; - setMiscData(key: string, value: string): unknown; + setMsgEmojiLikesForRole(...args: unknown[]): unknown; - getBookmarkData(...args: unknown[]): unknown; + clickInlineKeyboardButton(...args: unknown[]): unknown; - setBookmarkData(...args: unknown[]): unknown; + setCurOnScreenMsg(...args: unknown[]): unknown; - sendShowInputStatusReq(ChatType: number, EventType: number, toUid: string): Promise; + setCurOnScreenMsgForMsgEvent(...args: unknown[]): unknown; - queryCalendar(...args: unknown[]): unknown; + getMiscData(key: string): unknown; - queryFirstMsgSeq(peer: Peer, ...args: unknown[]): unknown; + setMiscData(key: string, value: string): unknown; - queryRoamCalendar(...args: unknown[]): unknown; + getBookmarkData(...args: unknown[]): unknown; - queryFirstRoamMsg(...args: unknown[]): unknown; + setBookmarkData(...args: unknown[]): unknown; - fetchLongMsg(peer: Peer, msgId: string): unknown; + sendShowInputStatusReq(ChatType: number, EventType: number, toUid: string): Promise; - fetchLongMsgWithCb(...args: unknown[]): unknown; + queryCalendar(...args: unknown[]): unknown; - setIsStopKernelFetchLongMsg(...args: unknown[]): unknown; + queryFirstMsgSeq(peer: Peer, ...args: unknown[]): unknown; - insertGameResultAsMsgToDb(...args: unknown[]): unknown; + queryRoamCalendar(...args: unknown[]): unknown; - getMultiMsg(...args: unknown[]): Promise; + queryFirstRoamMsg(...args: unknown[]): unknown; - setDraft(...args: unknown[]): unknown; + fetchLongMsg(peer: Peer, msgId: string): unknown; - getDraft(...args: unknown[]): unknown; + fetchLongMsgWithCb(...args: unknown[]): unknown; - deleteDraft(...args: unknown[]): unknown; + setIsStopKernelFetchLongMsg(...args: unknown[]): unknown; - getRecentHiddenSesionList(...args: unknown[]): unknown; + insertGameResultAsMsgToDb(...args: unknown[]): unknown; - setRecentHiddenSession(...args: unknown[]): unknown; + getMultiMsg(...args: unknown[]): Promise; - delRecentHiddenSession(...args: unknown[]): unknown; + setDraft(...args: unknown[]): unknown; - getCurHiddenSession(...args: unknown[]): unknown; + getDraft(...args: unknown[]): unknown; - setCurHiddenSession(...args: unknown[]): unknown; + deleteDraft(...args: unknown[]): unknown; - setReplyDraft(...args: unknown[]): unknown; + getRecentHiddenSesionList(...args: unknown[]): unknown; - getReplyDraft(...args: unknown[]): unknown; + setRecentHiddenSession(...args: unknown[]): unknown; - deleteReplyDraft(...args: unknown[]): unknown; + delRecentHiddenSession(...args: unknown[]): unknown; - getFirstUnreadAtMsg(peer: Peer): unknown; + getCurHiddenSession(...args: unknown[]): unknown; - clearMsgRecords(...args: unknown[]): unknown;//设置已读后调用我觉得比较好 清理记录 现在别了 + setCurHiddenSession(...args: unknown[]): unknown; - IsExistOldDb(...args: unknown[]): unknown; + setReplyDraft(...args: unknown[]): unknown; - canImportOldDbMsg(...args: unknown[]): unknown; + getReplyDraft(...args: unknown[]): unknown; - setPowerStatus(z: boolean): unknown; + deleteReplyDraft(...args: unknown[]): unknown; - canProcessDataMigration(...args: unknown[]): unknown; + getFirstUnreadAtMsg(peer: Peer): unknown; - importOldDbMsg(...args: unknown[]): unknown; + clearMsgRecords(...args: unknown[]): unknown;//设置已读后调用我觉得比较好 清理记录 现在别了 - stopImportOldDbMsgAndroid(...args: unknown[]): unknown; + IsExistOldDb(...args: unknown[]): unknown; - isMqqDataImportFinished(...args: unknown[]): unknown; + canImportOldDbMsg(...args: unknown[]): unknown; - getMqqDataImportTableNames(...args: unknown[]): unknown; + setPowerStatus(z: boolean): unknown; - getCurChatImportStatusByUin(...args: unknown[]): unknown; + canProcessDataMigration(...args: unknown[]): unknown; - getDataImportUserLevel(): unknown; + importOldDbMsg(...args: unknown[]): unknown; - getMsgQRCode(...args: unknown[]): unknown; + stopImportOldDbMsgAndroid(...args: unknown[]): unknown; - getGuestMsgAbstracts(...args: unknown[]): unknown; + isMqqDataImportFinished(...args: unknown[]): unknown; - getGuestMsgByRange(...args: unknown[]): unknown; + getMqqDataImportTableNames(...args: unknown[]): unknown; - getGuestMsgAbstractByRange(...args: unknown[]): unknown; + getCurChatImportStatusByUin(...args: unknown[]): unknown; - registerSysMsgNotification(...args: unknown[]): unknown; + getDataImportUserLevel(): unknown; - unregisterSysMsgNotification(...args: unknown[]): unknown; + getMsgQRCode(...args: unknown[]): unknown; - enterOrExitAio(...args: unknown[]): unknown; + getGuestMsgAbstracts(...args: unknown[]): unknown; - // this.peerUid = ""; - // this.peerNickname = ""; - // this.fromGroupCode = ""; - // this.sig = new byte[0]; - // this.selfUid = ""; - // this.selfPhone = ""; - // this.chatType = i2; - // this.peerUid = str; - // this.peerNickname = str2; - // this.fromGroupCode = str3; - // this.sig = bArr; - // this.selfUid = str4; - // this.selfPhone = str5; - // this.gameSession = tempChatGameSession; - prepareTempChat(args: unknown): unknown;//主动临时消息 不做 + getGuestMsgByRange(...args: unknown[]): unknown; - sendSsoCmdReqByContend(cmd: string, param: string): Promise; + getGuestMsgAbstractByRange(...args: unknown[]): unknown; - //chattype,uid->Promise - getTempChatInfo(ChatType: number, Uid: string): unknown; + registerSysMsgNotification(...args: unknown[]): unknown; - setContactLocalTop(...args: unknown[]): unknown; + unregisterSysMsgNotification(...args: unknown[]): unknown; - switchAnonymousChat(...args: unknown[]): unknown; + enterOrExitAio(...args: unknown[]): unknown; - renameAnonyChatNick(...args: unknown[]): unknown; + // this.peerUid = ""; + // this.peerNickname = ""; + // this.fromGroupCode = ""; + // this.sig = new byte[0]; + // this.selfUid = ""; + // this.selfPhone = ""; + // this.chatType = i2; + // this.peerUid = str; + // this.peerNickname = str2; + // this.fromGroupCode = str3; + // this.sig = bArr; + // this.selfUid = str4; + // this.selfPhone = str5; + // this.gameSession = tempChatGameSession; + prepareTempChat(args: unknown): unknown;//主动临时消息 不做 - getAnonymousInfo(...args: unknown[]): unknown; + sendSsoCmdReqByContend(cmd: string, param: string): Promise; - updateAnonymousInfo(...args: unknown[]): unknown; + //chattype,uid->Promise + getTempChatInfo(ChatType: number, Uid: string): unknown; - sendSummonMsg(peer: Peer, MsgElement: unknown, MsgAttributeInfo: unknown): Promise;//频道的东西 + setContactLocalTop(...args: unknown[]): unknown; - outputGuildUnreadInfo(...args: unknown[]): unknown; + switchAnonymousChat(...args: unknown[]): unknown; - checkMsgWithUrl(...args: unknown[]): unknown; + renameAnonyChatNick(...args: unknown[]): unknown; - checkTabListStatus(...args: unknown[]): unknown; + getAnonymousInfo(...args: unknown[]): unknown; - getABatchOfContactMsgBoxInfo(...args: unknown[]): unknown; + updateAnonymousInfo(...args: unknown[]): unknown; - insertMsgToMsgBox(peer: Peer, msgId: string, arg: 2006): unknown; + sendSummonMsg(peer: Peer, MsgElement: unknown, MsgAttributeInfo: unknown): Promise;//频道的东西 - isHitEmojiKeyword(...args: unknown[]): unknown; + outputGuildUnreadInfo(...args: unknown[]): unknown; - getKeyWordRelatedEmoji(...args: unknown[]): unknown; + checkMsgWithUrl(...args: unknown[]): unknown; - recordEmoji(...args: unknown[]): unknown; + checkTabListStatus(...args: unknown[]): unknown; - fetchGetHitEmotionsByWord(args: Object): Promise;//表情推荐? + getABatchOfContactMsgBoxInfo(...args: unknown[]): unknown; - deleteAllRoamMsgs(...args: unknown[]): unknown;//漫游消息? + insertMsgToMsgBox(peer: Peer, msgId: string, arg: 2006): unknown; - packRedBag(...args: unknown[]): unknown; + isHitEmojiKeyword(...args: unknown[]): unknown; - grabRedBag(...args: unknown[]): unknown; + getKeyWordRelatedEmoji(...args: unknown[]): unknown; - pullDetail(...args: unknown[]): unknown; + recordEmoji(...args: unknown[]): unknown; - selectPasswordRedBag(...args: unknown[]): unknown; + fetchGetHitEmotionsByWord(args: Object): Promise;//表情推荐? - pullRedBagPasswordList(...args: unknown[]): unknown; + deleteAllRoamMsgs(...args: unknown[]): unknown;//漫游消息? - requestTianshuAdv(...args: unknown[]): unknown; + packRedBag(...args: unknown[]): unknown; - tianshuReport(...args: unknown[]): unknown; + grabRedBag(...args: unknown[]): unknown; - tianshuMultiReport(...args: unknown[]): unknown; + pullDetail(...args: unknown[]): unknown; - GetMsgSubType(a0: number, a1: number): unknown; + selectPasswordRedBag(...args: unknown[]): unknown; - setIKernelPublicAccountAdapter(...args: unknown[]): unknown; - //tempChatGameSession有关 - createUidFromTinyId(fromTinyId: string, toTinyId: string): unknown; + pullRedBagPasswordList(...args: unknown[]): unknown; - dataMigrationGetDataAvaiableContactList(...args: unknown[]): unknown; + requestTianshuAdv(...args: unknown[]): unknown; - dataMigrationGetMsgList(...args: unknown[]): unknown; + tianshuReport(...args: unknown[]): unknown; - dataMigrationStopOperation(...args: unknown[]): unknown; + tianshuMultiReport(...args: unknown[]): unknown; - //新的希望 - dataMigrationImportMsgPbRecord(DataMigrationMsgInfo: Array<{ - extensionData: string//"Hex" - extraData: string //"" - chatType: number - chatUin: string - msgType: number - msgTime: string - msgSeq: string - msgRandom: string - }>, DataMigrationResourceInfo: { - extraData: string - filePath: string - fileSize: string - msgRandom: string - msgSeq: string - msgSubType: number - msgType: number - }): unknown; + GetMsgSubType(a0: number, a1: number): unknown; - dataMigrationGetResourceLocalDestinyPath(...args: unknown[]): unknown; + setIKernelPublicAccountAdapter(...args: unknown[]): unknown; - dataMigrationSetIOSPathPrefix(...args: unknown[]): unknown; + //tempChatGameSession有关 + createUidFromTinyId(fromTinyId: string, toTinyId: string): unknown; - getServiceAssistantSwitch(...args: unknown[]): unknown; + dataMigrationGetDataAvaiableContactList(...args: unknown[]): unknown; - setServiceAssistantSwitch(...args: unknown[]): unknown; + dataMigrationGetMsgList(...args: unknown[]): unknown; - setSubscribeFolderUsingSmallRedPoint(...args: unknown[]): unknown; + dataMigrationStopOperation(...args: unknown[]): unknown; - clearGuildNoticeRedPoint(...args: unknown[]): unknown; + //新的希望 + dataMigrationImportMsgPbRecord(DataMigrationMsgInfo: Array<{ + extensionData: string//"Hex" + extraData: string //"" + chatType: number + chatUin: string + msgType: number + msgTime: string + msgSeq: string + msgRandom: string + }>, DataMigrationResourceInfo: { + extraData: string + filePath: string + fileSize: string + msgRandom: string + msgSeq: string + msgSubType: number + msgType: number + }): unknown; - clearFeedNoticeRedPoint(...args: unknown[]): unknown; + dataMigrationGetResourceLocalDestinyPath(...args: unknown[]): unknown; - clearFeedSquareRead(...args: unknown[]): unknown; + dataMigrationSetIOSPathPrefix(...args: unknown[]): unknown; - IsC2CStyleChatType(...args: unknown[]): unknown; + getServiceAssistantSwitch(...args: unknown[]): unknown; - IsTempChatType(uin: number): unknown;//猜的 + setServiceAssistantSwitch(...args: unknown[]): unknown; - getGuildInteractiveNotification(...args: unknown[]): unknown; + setSubscribeFolderUsingSmallRedPoint(...args: unknown[]): unknown; - getGuildNotificationAbstract(...args: unknown[]): unknown; + clearGuildNoticeRedPoint(...args: unknown[]): unknown; - setFocusOnBase(...args: unknown[]): unknown; + clearFeedNoticeRedPoint(...args: unknown[]): unknown; - queryArkInfo(...args: unknown[]): unknown; + clearFeedSquareRead(...args: unknown[]): unknown; - queryUserSecQuality(...args: unknown[]): unknown; + IsC2CStyleChatType(...args: unknown[]): unknown; - getGuildMsgAbFlag(...args: unknown[]): unknown; + IsTempChatType(uin: number): unknown;//猜的 - getGroupMsgStorageTime(): unknown;//这是嘛啊 + getGuildInteractiveNotification(...args: unknown[]): unknown; + + getGuildNotificationAbstract(...args: unknown[]): unknown; + + setFocusOnBase(...args: unknown[]): unknown; + + queryArkInfo(...args: unknown[]): unknown; + + queryUserSecQuality(...args: unknown[]): unknown; + + getGuildMsgAbFlag(...args: unknown[]): unknown; + + getGroupMsgStorageTime(): unknown;//这是嘛啊 } diff --git a/src/core/services/NodeIKernelNodeMiscService.ts b/src/core/services/NodeIKernelNodeMiscService.ts index 150c2a69..9e07cf78 100644 --- a/src/core/services/NodeIKernelNodeMiscService.ts +++ b/src/core/services/NodeIKernelNodeMiscService.ts @@ -1,12 +1,17 @@ -import { GeneralCallResult } from "./common"; +import { GeneralCallResult } from './common'; //没扒干净 因为用不着 export interface NodeIKernelNodeMiscService { getMiniAppPath(): unknown; - setMiniAppVersion(version:string): unknown; + + setMiniAppVersion(version: string): unknown; + wantWinScreenOCR(imagepath: string): Promise; + SendMiniAppMsg(arg1: string, arg2: string, arg3: string): unknown; + startNewMiniApp(appfile: string, params: string): unknown; + // 我的计划是转发给一个新程序避免吃掉Electron_AS_Node的环境 然后重写启动MiniApp 挂载相应JS脚本 这样有个问题 // 需要自己转发ipc参数 然后必须处在gui环境 且完成校验破解 才能实现发包 有点抽象了 -} \ No newline at end of file +} diff --git a/src/core/services/NodeIKernelOnlineStatusService.ts b/src/core/services/NodeIKernelOnlineStatusService.ts index b89f5e01..c3c97062 100644 --- a/src/core/services/NodeIKernelOnlineStatusService.ts +++ b/src/core/services/NodeIKernelOnlineStatusService.ts @@ -1,36 +1,36 @@ export interface NodeIKernelOnlineStatusService { - addKernelOnlineStatusListener(listener: unknown): void; + addKernelOnlineStatusListener(listener: unknown): void; - removeKernelOnlineStatusListener(listenerId: unknown): void; + removeKernelOnlineStatusListener(listenerId: unknown): void; - getShouldShowAIOStatusAnimation(arg: unknown): unknown; + getShouldShowAIOStatusAnimation(arg: unknown): unknown; - setReadLikeList(arg: unknown): unknown; + setReadLikeList(arg: unknown): unknown; - getLikeList(arg: unknown): unknown; + getLikeList(arg: unknown): unknown; - setLikeStatus(arg: unknown): unknown; + setLikeStatus(arg: unknown): unknown; - getAggregationPageEntrance(): unknown; + getAggregationPageEntrance(): unknown; - didClickAggregationPageEntrance(): unknown; + didClickAggregationPageEntrance(): unknown; - getAggregationGroupModels(): unknown; + getAggregationGroupModels(): unknown; - // { - // "businessType": 1, - // "uins": [ - // "1627126029", - // "66600000", - // "71702575" - // ] - // } + // { + // "businessType": 1, + // "uins": [ + // "1627126029", + // "66600000", + // "71702575" + // ] + // } - checkLikeStatus(param: { - businessType: number, - uins: string[] - }): Promise; + checkLikeStatus(param: { + businessType: number, + uins: string[] + }): Promise; - isNull(): boolean; + isNull(): boolean; } diff --git a/src/core/services/NodeIKernelProfileLikeService.ts b/src/core/services/NodeIKernelProfileLikeService.ts index fa765695..a1f385e3 100644 --- a/src/core/services/NodeIKernelProfileLikeService.ts +++ b/src/core/services/NodeIKernelProfileLikeService.ts @@ -1,22 +1,21 @@ -import { BuddyProfileLikeReq } from "../entities/user"; -import { GeneralCallResult } from "./common"; +import { BuddyProfileLikeReq, GeneralCallResult } from '@/core'; export interface NodeIKernelProfileLikeService { - addKernelProfileLikeListener(listener: NodeIKernelProfileLikeService): void; + addKernelProfileLikeListener(listener: NodeIKernelProfileLikeService): void; - removeKernelProfileLikeListener(listener: unknown): void; + removeKernelProfileLikeListener(listener: unknown): void; - setBuddyProfileLike(...args: unknown[]): { result: number, errMsg: string, succCounts: number }; + setBuddyProfileLike(...args: unknown[]): { result: number, errMsg: string, succCounts: number }; - getBuddyProfileLike(req: BuddyProfileLikeReq): Promise, - "friendMaxVotes": number, - "start": number - } - }>; + getBuddyProfileLike(req: BuddyProfileLikeReq): Promise, + 'friendMaxVotes': number, + 'start': number + } + }>; - getProfileLikeScidResourceInfo(...args: unknown[]): void; + getProfileLikeScidResourceInfo(...args: unknown[]): void; - isNull(): boolean; + isNull(): boolean; } diff --git a/src/core/services/NodeIKernelProfileService.ts b/src/core/services/NodeIKernelProfileService.ts index e626a332..2e0885e7 100644 --- a/src/core/services/NodeIKernelProfileService.ts +++ b/src/core/services/NodeIKernelProfileService.ts @@ -1,103 +1,109 @@ import { AnyCnameRecord } from 'node:dns'; -import { BaseInfo, BizKey, CoreInfo, ModifyProfileParams, SimpleInfo, UserDetailInfoByUin } from '../entities'; +import { BizKey, ModifyProfileParams, SimpleInfo, UserDetailInfoByUin } from '../entities'; import { NodeIKernelProfileListener } from '../listeners'; import { GeneralCallResult } from '@/core/services/common'; + export enum UserDetailSource { - KDB, - KSERVER + KDB, + KSERVER } + export enum ProfileBizType { - KALL, - KBASEEXTEND, - KVAS, - KQZONE, - KOTHER + KALL, + KBASEEXTEND, + KVAS, + KQZONE, + KOTHER } + export interface NodeIKernelProfileService { - getUidByUin(callfrom: string, uin: Array): Promise>;//uin->uid + getUidByUin(callfrom: string, uin: Array): Promise>;//uin->uid - getUinByUid(callfrom: string, uid: Array): Promise>; - // { - // coreInfo: CoreInfo, - // baseInfo: BaseInfo, - // status: null, - // vasInfo: null, - // relationFlags: null, - // otherFlags: null, - // intimate: null - // } - getCoreAndBaseInfo(callfrom: string, uids: string[]): Promise>; + getUinByUid(callfrom: string, uid: Array): Promise>; - fetchUserDetailInfo(trace: string, uids: string[], arg2: number, arg3: number[]): Promise; + // { + // coreInfo: CoreInfo, + // baseInfo: BaseInfo, + // status: null, + // vasInfo: null, + // relationFlags: null, + // otherFlags: null, + // intimate: null + // } + getCoreAndBaseInfo(callfrom: string, uids: string[]): Promise>; - addKernelProfileListener(listener: NodeIKernelProfileListener): number; + fetchUserDetailInfo(trace: string, uids: string[], arg2: number, arg3: number[]): Promise; - removeKernelProfileListener(listenerId: number): void; + addKernelProfileListener(listener: NodeIKernelProfileListener): number; - prepareRegionConfig(...args: unknown[]): unknown; + removeKernelProfileListener(listenerId: number): void; - getLocalStrangerRemark(): Promise; + prepareRegionConfig(...args: unknown[]): unknown; - enumCountryOptions(): Array; + getLocalStrangerRemark(): Promise; - enumProvinceOptions(Country: string): Array; + enumCountryOptions(): Array; - enumCityOptions(Country: string, Province: string): unknown; + enumProvinceOptions(Country: string): Array; - enumAreaOptions(...args: unknown[]): unknown; + enumCityOptions(Country: string, Province: string): unknown; - //SimpleInfo - // this.uid = ""; - // this.uid = str; - // this.uin = j2; - // this.isBuddy = z; - // this.coreInfo = coreInfo; - // this.baseInfo = baseInfo; - // this.status = statusInfo; - // this.vasInfo = vasInfo; - // this.relationFlags = relationFlag; - // this.otherFlags = otherFlag; - // this.intimate = intimate; + enumAreaOptions(...args: unknown[]): unknown; - modifySelfProfile(...args: unknown[]): Promise; + //SimpleInfo + // this.uid = ""; + // this.uid = str; + // this.uin = j2; + // this.isBuddy = z; + // this.coreInfo = coreInfo; + // this.baseInfo = baseInfo; + // this.status = statusInfo; + // this.vasInfo = vasInfo; + // this.relationFlags = relationFlag; + // this.otherFlags = otherFlag; + // this.intimate = intimate; - modifyDesktopMiniProfile(param: ModifyProfileParams): Promise; + modifySelfProfile(...args: unknown[]): Promise; - setNickName(NickName: string): Promise; + modifyDesktopMiniProfile(param: ModifyProfileParams): Promise; - setLongNick(longNick: string): Promise; + setNickName(NickName: string): Promise; - setBirthday(...args: unknown[]): Promise; + setLongNick(longNick: string): Promise; - setGander(...args: unknown[]): Promise; + setBirthday(...args: unknown[]): Promise; - setHeader(arg: string): Promise; + setGander(...args: unknown[]): Promise; - setRecommendImgFlag(...args: unknown[]): Promise; + setHeader(arg: string): Promise; - getUserSimpleInfo(force: boolean, uids: string[],): Promise; + setRecommendImgFlag(...args: unknown[]): Promise; - getUserDetailInfo(uid: string): Promise; + getUserSimpleInfo(force: boolean, uids: string[]): Promise; - getUserDetailInfoWithBizInfo(uid: string, Biz: BizKey[]): Promise; + getUserDetailInfo(uid: string): Promise; - getUserDetailInfoByUin(uin: string): Promise; + getUserDetailInfoWithBizInfo(uid: string, Biz: BizKey[]): Promise; - getZplanAvatarInfos(args: string[]): Promise; + getUserDetailInfoByUin(uin: string): Promise; - getStatus(uid: string): Promise; + getZplanAvatarInfos(args: string[]): Promise; - startStatusPolling(isForceReset: boolean): Promise; + getStatus(uid: string): Promise; - getSelfStatus(): Promise; - // - setdisableEmojiShortCuts(...args: unknown[]): unknown; + startStatusPolling(isForceReset: boolean): Promise; - getProfileQzonePicInfo(uid: string, type: number, force: boolean): Promise; + getSelfStatus(): Promise; - //profileService.getCoreInfo("UserRemarkServiceImpl::getStrangerRemarkByUid", arrayList); - getCoreInfo(name: string, arg: any[]): unknown; - //m429253e12.getOtherFlag("FriendListInfoCache_getKernelDataAndPutCache", new ArrayList<>()); - isNull(): boolean; + // + setdisableEmojiShortCuts(...args: unknown[]): unknown; + + getProfileQzonePicInfo(uid: string, type: number, force: boolean): Promise; + + //profileService.getCoreInfo("UserRemarkServiceImpl::getStrangerRemarkByUid", arrayList); + getCoreInfo(name: string, arg: any[]): unknown; + + //m429253e12.getOtherFlag("FriendListInfoCache_getKernelDataAndPutCache", new ArrayList<>()); + isNull(): boolean; } diff --git a/src/core/services/NodeIKernelRecentContactService.ts b/src/core/services/NodeIKernelRecentContactService.ts index ffe8cc96..556b3281 100644 --- a/src/core/services/NodeIKernelRecentContactService.ts +++ b/src/core/services/NodeIKernelRecentContactService.ts @@ -1,6 +1,7 @@ -import { ChatType, Peer } from "../entities"; -import { NodeIKernelRecentContactListener } from "../listeners/NodeIKernelRecentContactListener"; -import { GeneralCallResult } from "./common"; +import { ChatType, Peer } from '../entities'; +import { NodeIKernelRecentContactListener } from '../listeners/NodeIKernelRecentContactListener'; +import { GeneralCallResult } from './common'; + export interface FSABRecentContactParams { anchorPointContact: { contactId: string; @@ -12,6 +13,7 @@ export interface FSABRecentContactParams { count: number; fetchOld: boolean; } + // { // "anchorPointContact": { // "contactId": "", @@ -34,16 +36,17 @@ export interface NodeIKernelRecentContactService { enterOrExitMsgList(...args: unknown[]): unknown; // 1 arguments - /*!---!*/getRecentContactListSnapShot(count: number): Promise, changedList: Array<{ - remark: any; - peerName: any; - sendMemberName: any; - sendNickName: any; + remark: any; + peerName: any; + sendMemberName: any; + sendNickName: any; peerUid: string; peerUin: string, msgTime: string, chatType: ChatType, msgId: string }> } @@ -55,7 +58,8 @@ export interface NodeIKernelRecentContactService { jumpToSpecifyRecentContact(...args: unknown[]): unknown; // 1 arguments - /*!---!*/fetchAndSubscribeABatchOfRecentContact(params: FSABRecentContactParams): unknown; // 1 arguments + /*!---!*/ + fetchAndSubscribeABatchOfRecentContact(params: FSABRecentContactParams): unknown; // 1 arguments addRecentContact(peer: Peer): unknown; @@ -96,4 +100,4 @@ export interface NodeIKernelRecentContactService { setAllGameMsgRead(): unknown; getRecentContactListSync(): unknown; -} \ No newline at end of file +} diff --git a/src/core/services/NodeIKernelRichMediaService.ts b/src/core/services/NodeIKernelRichMediaService.ts index b9bd321a..e76761f2 100644 --- a/src/core/services/NodeIKernelRichMediaService.ts +++ b/src/core/services/NodeIKernelRichMediaService.ts @@ -1,5 +1,6 @@ -import { GetFileListParam, MessageElement, Peer, SendMessageElement } from "../entities"; -import { GeneralCallResult } from "./common"; +import { GetFileListParam, MessageElement, Peer } from '../entities'; +import { GeneralCallResult } from './common'; + export enum UrlFileDownloadType { KUNKNOWN, KURLFILEDOWNLOADPRIVILEGEICON, @@ -8,6 +9,7 @@ export enum UrlFileDownloadType { KURLFILEDOWNLOADCOMMON, KURLFILEDOWNLOADINSTALLAPP } + export enum RMBizTypeEnum { KUNKNOWN, KC2CFILE, @@ -25,6 +27,7 @@ export enum RMBizTypeEnum { KGUILDPTT, KGUILDVIDEO } + export interface CommonFileInfo { bizType: number; chatType: number; @@ -39,12 +42,13 @@ export interface CommonFileInfo { msgTime: string; parent: string; peerUid: string; - picThumbPath: Array + picThumbPath: Array; sha: string; sha3: string; subId: string; uuid: string; } + export interface NodeIKernelRichMediaService { //getVideoPlayUrl(peer, msgId, elemId, videoCodecFormat, VideoRequestWay.KHAND, cb); // public enum VideoCodecFormatType { @@ -77,7 +81,10 @@ export interface NodeIKernelRichMediaService { // public static final int KTRIGGERTYPEAUTO = 1; // public static final int KTRIGGERTYPEMANUAL = 0; - getVideoPlayUrlV2(peer: Peer, msgId: string, elemId: string, videoCodecFormat: number, exParams: { downSourceType: number, triggerType: number }): Promise; + deleteGroupFolder(GroupCode: string, FolderId: string): Promise; //参数与getVideoPlayUrlInVisit一样 downloadRichMediaInVisit(arg: { @@ -144,8 +153,10 @@ export interface NodeIKernelRichMediaService { ele: MessageElement, useHttps: boolean }): unknown; + //arg3为“” downloadFileForModelId(peer: Peer, ModelId: string[], arg3: string): unknown; + //第三个参数 Array // this.fileId = ""; // this.fileName = ""; @@ -165,7 +176,9 @@ export interface NodeIKernelRichMediaService { downloadFileForFileInfo(fileInfo: CommonFileInfo[], savePath: string): unknown; - createGroupFolder(GroupCode: string, FolderName: string): Promise } }> + createGroupFolder(GroupCode: string, FolderName: string): Promise } + }>; downloadFile(commonFile: CommonFileInfo, arg2: unknown, arg3: unknown, savePath: string): unknown; @@ -218,6 +231,7 @@ export interface NodeIKernelRichMediaService { sortType: number, groupNames: Array }): Promise; + searchGroupFileByWord(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown, arg5: unknown): unknown; deleteGroupFile(GroupCode: string, params: Array, Files: Array): Promise; - batchGetGroupFileCount(Gids: Array): Promise, groupFileCounts: Array }>; + batchGetGroupFileCount(Gids: Array): Promise, + groupFileCounts: Array + }>; queryPicDownloadSize(arg: unknown): unknown; @@ -263,4 +280,4 @@ export interface NodeIKernelRichMediaService { }): Promise; isNull(): boolean; -} \ No newline at end of file +} diff --git a/src/core/services/NodeIKernelRobotService.ts b/src/core/services/NodeIKernelRobotService.ts index 9df5cdce..f3c88a20 100644 --- a/src/core/services/NodeIKernelRobotService.ts +++ b/src/core/services/NodeIKernelRobotService.ts @@ -1,4 +1,4 @@ -import { NodeIKernelRobotListener } from "@/core/listeners"; +import { NodeIKernelRobotListener } from '@/core/listeners'; export interface NodeIKernelRobotService { fetchGroupRobotStoreDiscovery(arg: unknown): unknown; @@ -29,7 +29,7 @@ export interface NodeIKernelRobotService { setRobotPickTts(arg1: unknown, arg2: unknown): unknown; - getRobotUinRange(data: any): Promise<{ response: { robotUinRanges: any } }> + getRobotUinRange(data: any): Promise<{ response: { robotUinRanges: any } }>; isNull(): boolean; } diff --git a/src/core/services/NodeIKernelSearchService.ts b/src/core/services/NodeIKernelSearchService.ts index 3f91a0e3..978773e9 100644 --- a/src/core/services/NodeIKernelSearchService.ts +++ b/src/core/services/NodeIKernelSearchService.ts @@ -1,4 +1,4 @@ -import { ChatType } from "../entities"; +import { ChatType } from '../entities'; export interface NodeIKernelSearchService { addKernelSearchListener(...args: any[]): unknown;// needs 1 arguments @@ -90,8 +90,7 @@ export interface NodeIKernelSearchService { hasModifyConfGroupName: boolean, groupName: string, remark: string - }> - , + }>, dataLineChatInfo: [], tmpChatInfo: [], msgId: string, diff --git a/src/core/services/NodeIKernelStorageCleanService.ts b/src/core/services/NodeIKernelStorageCleanService.ts index 34c26714..ed7aa2e4 100644 --- a/src/core/services/NodeIKernelStorageCleanService.ts +++ b/src/core/services/NodeIKernelStorageCleanService.ts @@ -1,41 +1,41 @@ -import { NodeIKernelStorageCleanListener } from "@/core/listeners"; -import { GeneralCallResult } from "./common"; +import { NodeIKernelStorageCleanListener } from '@/core/listeners'; +import { GeneralCallResult } from './common'; export interface NodeIKernelStorageCleanService { - addKernelStorageCleanListener(Listener: NodeIKernelStorageCleanListener): number; + addKernelStorageCleanListener(Listener: NodeIKernelStorageCleanListener): number; - removeKernelStorageCleanListener(ListenerId: number): void; + removeKernelStorageCleanListener(ListenerId: number): void; - addCacheScanedPaths(arg: unknown): unknown; + addCacheScanedPaths(arg: unknown): unknown; - addFilesScanedPaths(arg: unknown): unknown; + addFilesScanedPaths(arg: unknown): unknown; - scanCache(): Promise; + scanCache(): Promise; - addReportData(arg: unknown): unknown; + addReportData(arg: unknown): unknown; - reportData(): unknown; + reportData(): unknown; - getChatCacheInfo(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown; + getChatCacheInfo(arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown): unknown; - getFileCacheInfo(arg1: unknown, arg2: unknown, arg3: unknown, arg44: unknown, args5: unknown): unknown; + getFileCacheInfo(arg1: unknown, arg2: unknown, arg3: unknown, arg44: unknown, args5: unknown): unknown; - clearChatCacheInfo(arg1: unknown, arg2: unknown): unknown; + clearChatCacheInfo(arg1: unknown, arg2: unknown): unknown; - clearCacheDataByKeys(arg: unknown): unknown; + clearCacheDataByKeys(arg: unknown): unknown; - setSilentScan(arg: unknown): unknown; + setSilentScan(arg: unknown): unknown; - closeCleanWindow(): unknown; + closeCleanWindow(): unknown; - clearAllChatCacheInfo(): unknown; + clearAllChatCacheInfo(): unknown; - endScan(arg: unknown): unknown; + endScan(arg: unknown): unknown; - addNewDownloadOrUploadFile(arg: unknown): unknown; + addNewDownloadOrUploadFile(arg: unknown): unknown; - isNull(): boolean; + isNull(): boolean; } diff --git a/src/core/services/NodeIKernelTianShuService.ts b/src/core/services/NodeIKernelTianShuService.ts index 48622c7e..caf408aa 100644 --- a/src/core/services/NodeIKernelTianShuService.ts +++ b/src/core/services/NodeIKernelTianShuService.ts @@ -6,5 +6,5 @@ export interface NodeIKernelTianShuService { requesTianShuNumeralRe(...args: any[]): unknown;//d needs 1 arguments reportTianShuNumeralRed(...args: any[]): unknown;// needs 1 arguments - -} \ No newline at end of file + +} diff --git a/src/core/services/NodeIKernelTicketService.ts b/src/core/services/NodeIKernelTicketService.ts index 0178f755..3f95a867 100644 --- a/src/core/services/NodeIKernelTicketService.ts +++ b/src/core/services/NodeIKernelTicketService.ts @@ -1,12 +1,12 @@ -import { forceFetchClientKeyRetType } from "./common"; +import { forceFetchClientKeyRetType } from './common'; export interface NodeIKernelTicketService { - addKernelTicketListener(listener: unknown): void; + addKernelTicketListener(listener: unknown): void; - removeKernelTicketListener(listenerId: unknown): void; + removeKernelTicketListener(listenerId: unknown): void; - forceFetchClientKey(arg: string): Promise; + forceFetchClientKey(arg: string): Promise; - isNull(): boolean; -} \ No newline at end of file + isNull(): boolean; +} diff --git a/src/core/services/NodeIKernelTipOffService.ts b/src/core/services/NodeIKernelTipOffService.ts index 7071f893..756eaa8b 100644 --- a/src/core/services/NodeIKernelTipOffService.ts +++ b/src/core/services/NodeIKernelTipOffService.ts @@ -1,4 +1,4 @@ -import { GeneralCallResult } from "./common"; +import { GeneralCallResult } from './common'; export interface NodeIKernelTipOffService { @@ -8,7 +8,9 @@ export interface NodeIKernelTipOffService { tipOffSendJsData(args: unknown[]): Promise;//2 - getPskey(domainList: string[], nocache: boolean): Promise }>;//2 + getPskey(domainList: string[], nocache: boolean): Promise + }>;//2 tipOffSendJsData(args: unknown[]): Promise;//2 @@ -17,4 +19,4 @@ export interface NodeIKernelTipOffService { encodeUinAesInfo(args: unknown[]): Promise;//2 isNull(): boolean; -} \ No newline at end of file +} diff --git a/src/core/services/NodeIKernelUnitedConfigService.ts b/src/core/services/NodeIKernelUnitedConfigService.ts index f96a4f0e..6c02b27b 100644 --- a/src/core/services/NodeIKernelUnitedConfigService.ts +++ b/src/core/services/NodeIKernelUnitedConfigService.ts @@ -1,6 +1,6 @@ -export interface NodeIKernelUnitedConfigService{ +export interface NodeIKernelUnitedConfigService { addKernelUnitedConfigListener(...args: any[]): unknown;// needs 1 arguments - + removeKernelUnitedConfigListener(...args: any[]): unknown;// needs 1 arguments fetchUnitedCommendConfig(...args: any[]): unknown;// needs 1 arguments diff --git a/src/core/services/NodeIkernelTestPerformanceService.ts b/src/core/services/NodeIkernelTestPerformanceService.ts index ae774898..427aaa0c 100644 --- a/src/core/services/NodeIkernelTestPerformanceService.ts +++ b/src/core/services/NodeIkernelTestPerformanceService.ts @@ -1,4 +1,4 @@ -import { MessageElement, Peer } from "../entities"; +import { MessageElement, Peer } from '../entities'; export interface NodeIkernelTestPerformanceService { insertMsg(MsgParam: { @@ -11,4 +11,4 @@ export interface NodeIkernelTestPerformanceService { numPerTime: number }, msg: Array): Promise; -} \ No newline at end of file +} diff --git a/src/core/services/common.ts b/src/core/services/common.ts index 68ffc48c..e7e2bf17 100644 --- a/src/core/services/common.ts +++ b/src/core/services/common.ts @@ -2,13 +2,15 @@ export enum GeneralCallResultStatus { OK = 0, // ERROR = 1, } -export interface GeneralCallResult{ + +export interface GeneralCallResult { result: GeneralCallResultStatus, errMsg: string } + export interface forceFetchClientKeyRetType extends GeneralCallResult { url: string; keyIndex: string; clientKey: string; expireTime: string; - } \ No newline at end of file +} diff --git a/src/core/wrapper/context.ts b/src/core/wrapper/context.ts index 2938c704..a658d6d0 100644 --- a/src/core/wrapper/context.ts +++ b/src/core/wrapper/context.ts @@ -1,10 +1,8 @@ -import { LogWrapper } from "@/common/utils/log"; -import { QQBasicInfoWrapper } from "@/common/utils/QQBasicInfo"; -import { NapCatCoreWorkingEnv } from "@/core"; -import { NodeIKernelLoginService } from '@/core'; -import { WrapperNodeApi, NodeIQQNTWrapperSession } from "@/core"; -import { NTQQFileApi, NTQQFriendApi, NTQQGroupApi, NTQQMsgApi, NTQQSystemApi, NTQQUserApi, NTQQWebApi } from "../apis"; -import { NTQQCollectionApi } from "../apis/collection"; +import { LogWrapper } from '@/common/utils/log'; +import { QQBasicInfoWrapper } from '@/common/utils/QQBasicInfo'; +import { NapCatCoreWorkingEnv, NodeIKernelLoginService, NodeIQQNTWrapperSession, WrapperNodeApi } from '@/core'; +import { NTQQFileApi, NTQQFriendApi, NTQQGroupApi, NTQQMsgApi, NTQQSystemApi, NTQQUserApi, NTQQWebApi } from '../apis'; +import { NTQQCollectionApi } from '../apis/collection'; import { NapCatPathWrapper } from '@/common/framework/napcat'; export interface InstanceContext { diff --git a/src/core/wrapper/helper.ts b/src/core/wrapper/helper.ts index 405ac035..9e3dfe5a 100644 --- a/src/core/wrapper/helper.ts +++ b/src/core/wrapper/helper.ts @@ -1,7 +1,7 @@ -import path from "node:path"; -import fs from "node:fs"; -import { PlatformType, VendorType, WrapperSessionInitConfig } from "./wrapper"; -import { getMachineId, hostname, systemName, systemVersion } from "@/common/utils/system"; +import path from 'node:path'; +import fs from 'node:fs'; +import { PlatformType, VendorType, WrapperSessionInitConfig } from './wrapper'; +import { getMachineId, hostname, systemName, systemVersion } from '@/common/utils/system'; export async function genSessionConfig(QQVersionAppid: string, QQVersion: string, selfUin: string, selfUid: string, account_path: string): Promise { const downloadPath = path.join(account_path, 'NapCat', 'temp'); @@ -11,7 +11,7 @@ export async function genSessionConfig(QQVersionAppid: string, QQVersion: string selfUin, selfUid, desktopPathConfig: { - account_path // 可以通过NodeQQNTWrapperUtil().getNTUserDataInfoConfig()获取 + account_path, // 可以通过NodeQQNTWrapperUtil().getNTUserDataInfoConfig()获取 }, clientVer: QQVersion, // 9.9.8-22355 a2: '', @@ -34,7 +34,7 @@ export async function genSessionConfig(QQVersionAppid: string, QQVersion: string osVersion: '', bundleId: '', serverUrl: '', - fixedAfterHitKeys: [''] + fixedAfterHitKeys: [''], }, defaultFileDownloadPath: downloadPath, deviceInfo: { @@ -47,9 +47,9 @@ export async function genSessionConfig(QQVersionAppid: string, QQVersion: string osVer: systemVersion, vendorOsName: systemName, setMute: false, - vendorType: VendorType.KNOSETONIOS + vendorType: VendorType.KNOSETONIOS, }, - deviceConfig: '{"appearance":{"isSplitViewMode":true},"msg":{}}' + deviceConfig: '{"appearance":{"isSplitViewMode":true},"msg":{}}', }; return config; } diff --git a/src/core/wrapper/wrapper.ts b/src/core/wrapper/wrapper.ts index 4685ae7c..e2fcad1f 100644 --- a/src/core/wrapper/wrapper.ts +++ b/src/core/wrapper/wrapper.ts @@ -1,43 +1,42 @@ -import path from "node:path"; -import fs from "node:fs"; -import { NodeIDependsAdapter, NodeIDispatcherAdapter, NodeIGlobalAdapter } from "../adapters"; +import { NodeIDependsAdapter, NodeIDispatcherAdapter, NodeIGlobalAdapter } from '../adapters'; import { - NodeIKernelSessionListener, - NodeIKernelMsgListener, - NodeIKernelLoginListener, NodeIKernelBuddyListener, NodeIKernelGroupListener, + NodeIKernelLoginListener, + NodeIKernelMsgListener, NodeIKernelProfileListener, -} from "../listeners"; + NodeIKernelSessionListener, +} from '../listeners'; import { - NodeIKernelLoginService, - NodeIKernelMsgService, + NodeIKernelAvatarService, NodeIKernelBuddyService, NodeIKernelGroupService, - NodeIKernelProfileService, + NodeIKernelLoginService, + NodeIKernelMsgService, NodeIKernelProfileLikeService, + NodeIKernelProfileService, + NodeIKernelRichMediaService, NodeIKernelTicketService, NodeIKernelTipOffService, - NodeIKernelRichMediaService, - NodeIKernelAvatarService, -} from "../services"; -import { NodeIKernelStorageCleanService } from "../services/NodeIKernelStorageCleanService"; -import { NodeIKernelRobotService } from "../services/NodeIKernelRobotService"; -import { NodeIKernelNodeMiscService } from "../services/NodeIKernelNodeMiscService"; -import { NodeIKernelUixConvertService } from "../services/NodeIKernelUixConvertService"; -import { NodeIKernelMsgBackupService } from "../services/NodeIKernelMsgBackupService"; -import { NodeIKernelAlbumService } from "../services/NodeIKernelAlbumService"; -import { NodeIKernelTianShuService } from "../services/NodeIKernelTianShuService"; -import { NodeIKernelUnitedConfigService } from "../services/NodeIKernelUnitedConfigService"; -import { NodeIKernelSearchService } from "../services/NodeIKernelSearchService"; -import { NodeIKernelCollectionService } from "../services/NodeIKernelCollectionService"; -import { NodeIKernelRecentContactService } from "../services/NodeIKernelRecentContactService"; -import { NodeIKernelMSFService } from "../services/NodeIKernelMSFService"; -import { NodeIkernelTestPerformanceService } from "../services/NodeIkernelTestPerformanceService"; -import { NodeIKernelECDHService } from "../services/NodeIKernelECDHService"; +} from '../services'; +import { NodeIKernelStorageCleanService } from '../services/NodeIKernelStorageCleanService'; +import { NodeIKernelRobotService } from '../services/NodeIKernelRobotService'; +import { NodeIKernelNodeMiscService } from '../services/NodeIKernelNodeMiscService'; +import { NodeIKernelUixConvertService } from '../services/NodeIKernelUixConvertService'; +import { NodeIKernelMsgBackupService } from '../services/NodeIKernelMsgBackupService'; +import { NodeIKernelAlbumService } from '../services/NodeIKernelAlbumService'; +import { NodeIKernelTianShuService } from '../services/NodeIKernelTianShuService'; +import { NodeIKernelUnitedConfigService } from '../services/NodeIKernelUnitedConfigService'; +import { NodeIKernelSearchService } from '../services/NodeIKernelSearchService'; +import { NodeIKernelCollectionService } from '../services/NodeIKernelCollectionService'; +import { NodeIKernelRecentContactService } from '../services/NodeIKernelRecentContactService'; +import { NodeIKernelMSFService } from '../services/NodeIKernelMSFService'; +import { NodeIkernelTestPerformanceService } from '../services/NodeIkernelTestPerformanceService'; +import { NodeIKernelECDHService } from '../services/NodeIKernelECDHService'; + export interface NodeQQNTWrapperUtil { // eslint-disable-next-line @typescript-eslint/no-misused-new - new (): NodeQQNTWrapperUtil; + new(): NodeQQNTWrapperUtil; getNTUserDataInfoConfig(): string; @@ -110,7 +109,7 @@ export interface NodeQQNTWrapperUtil { arg1: unknown, arg2: unknown, arg3: number, - arg4: number + arg4: number, ): unknown; reportCountIndicators( @@ -118,7 +117,7 @@ export interface NodeQQNTWrapperUtil { arg1: Map, arg2: string, arg3: number, - arg4: boolean + arg4: boolean, ): unknown; reportValueIndicators( @@ -126,7 +125,7 @@ export interface NodeQQNTWrapperUtil { arg1: Map, arg2: string, arg3: boolean, - arg4: number + arg4: number, ): unknown; checkNewUserDataSaveDirAvailable(arg0: string): unknown; @@ -150,13 +149,13 @@ export interface NodeQQNTWrapperUtil { export interface NodeIQQNTWrapperSession { // eslint-disable-next-line @typescript-eslint/no-misused-new - new (): NodeIQQNTWrapperSession; + new(): NodeIQQNTWrapperSession; init( wrapperSessionInitConfig: WrapperSessionInitConfig, nodeIDependsAdapter: NodeIDependsAdapter, nodeIDispatcherAdapter: NodeIDispatcherAdapter, - nodeIKernelSessionListener: NodeIKernelSessionListener + nodeIKernelSessionListener: NodeIKernelSessionListener, ): void; startNT(n: 0): void; @@ -270,7 +269,8 @@ export interface EnginInitDesktopConfig { export interface NodeIQQNTWrapperEngine { // eslint-disable-next-line @typescript-eslint/no-misused-new - new (): NodeIQQNTWrapperEngine; + new(): NodeIQQNTWrapperEngine; + initWithDeskTopConfig(config: EnginInitDesktopConfig, nodeIGlobalAdapter: NodeIGlobalAdapter): void; } @@ -292,6 +292,7 @@ export interface WrapperNodeApi { NodeIKernelProfileService: NodeIKernelProfileService; NodeIKernelProfileListener: NodeIKernelProfileListener; } + export enum PlatformType { KUNKNOWN, KANDROID, @@ -299,12 +300,14 @@ export enum PlatformType { KWINDOWS, KMAC, } + export enum DeviceType { KUNKNOWN, KPHONE, KPAD, KCOMPUTER, } + //推送类型 export enum VendorType { KNOSETONIOS = 0, @@ -315,6 +318,7 @@ export enum VendorType { KSUPPORTVIVOPUSH = 5, KUNSUPPORTANDROIDPUSH = 1, } + export interface WrapperSessionInitConfig { selfUin: string; selfUid: string; diff --git a/src/external/napcat.json b/src/external/napcat.json index 9412e77a..1c822077 100644 --- a/src/external/napcat.json +++ b/src/external/napcat.json @@ -1,6 +1,6 @@ { - "fileLog": true, - "consoleLog": true, - "fileLogLevel": "debug", - "consoleLogLevel": "info" -} \ No newline at end of file + "fileLog": true, + "consoleLog": true, + "fileLogLevel": "debug", + "consoleLogLevel": "info" +} diff --git a/src/external/onebot11.json b/src/external/onebot11.json index eadb0142..8ee5a368 100644 --- a/src/external/onebot11.json +++ b/src/external/onebot11.json @@ -1,31 +1,31 @@ { - "http": { - "enable": false, - "host": "", - "port": 3000, - "secret": "", - "enableHeart": false, - "enablePost": false, - "postUrls": [] - }, - "ws": { - "enable": false, - "host": "", - "port": 3001 - }, - "reverseWs": { - "enable": false, - "urls": [] - }, - "GroupLocalTime": { - "Record": false, - "RecordList": [] - }, - "debug": false, - "heartInterval": 30000, - "messagePostFormat": "array", - "enableLocalFile2Url": true, - "musicSignUrl": "", - "reportSelfMessage": false, - "token": "" -} \ No newline at end of file + "http": { + "enable": false, + "host": "", + "port": 3000, + "secret": "", + "enableHeart": false, + "enablePost": false, + "postUrls": [] + }, + "ws": { + "enable": false, + "host": "", + "port": 3001 + }, + "reverseWs": { + "enable": false, + "urls": [] + }, + "GroupLocalTime": { + "Record": false, + "RecordList": [] + }, + "debug": false, + "heartInterval": 30000, + "messagePostFormat": "array", + "enableLocalFile2Url": true, + "musicSignUrl": "", + "reportSelfMessage": false, + "token": "" +} diff --git a/src/framework/napcat.cjs b/src/framework/napcat.cjs index ac3e8e85..fc3a424c 100644 --- a/src/framework/napcat.cjs +++ b/src/framework/napcat.cjs @@ -27,9 +27,9 @@ process.dlopen = (module, filename, flags = os.constants.dlopen.RTLD_LAZY) => { if (args[ArgIndex] instanceof Object) { let HookArg = {}; for (let ListenerName in args[ArgIndex]) { - HookArg[ListenerName] = function (...ListenerData) { + HookArg[ListenerName] = function(...ListenerData) { try { - if (ListenerName === "onSessionInitComplete") { + if (ListenerName === 'onSessionInitComplete') { //回调成功 initCallBack.forEach((cb) => cb(...ListenerData)); clearHook(); @@ -110,15 +110,15 @@ async function fetchServices(timeout = 10000) { pollForNTInitializationCheck(), new Promise((resolve) => { setTimeout(() => resolve(false), timeout); - }) + }), ]).then(result => result ? { wrapperSession, wrapperNodeApi, wrapperLoginService } : - Promise.reject() + Promise.reject(), ); } async function NCInit() { - console.log("[NapCat] [Info] 开始初始化NapCat"); + console.log('[NapCat] [Info] 开始初始化NapCat'); try { const { wrapperSession, wrapperLoginService } = await fetchServices(); @@ -127,7 +127,7 @@ async function NCInit() { await NCoreInitFramework(wrapperSession, wrapperLoginService, registerInitCallback); //console.log("[NapCat] [Info] NapCat初始化完成"); } catch (error) { - console.error("[NapCat] [Error] 初始化NapCat失败", error); + console.error('[NapCat] [Error] 初始化NapCat失败', error); } } diff --git a/src/framework/napcat.ts b/src/framework/napcat.ts index 33d19eb4..c87e7ec4 100644 --- a/src/framework/napcat.ts +++ b/src/framework/napcat.ts @@ -1,24 +1,23 @@ -import { NapCatPathWrapper } from "@/common/framework/napcat"; -import { LogWrapper } from "@/common/utils/log"; -import { proxiedListenerOf } from "@/common/utils/proxy-handler"; -import { QQBasicInfoWrapper } from "@/common/utils/QQBasicInfo"; -import { NapCatCore, NapCatCoreWorkingEnv, loadQQWrapper } from "@/core/core"; -import { InstanceContext } from "@/core"; -import { SelfInfo } from "@/core/entities"; -import { LoginListener } from "@/core/listeners"; -import { NodeIKernelLoginService } from "@/core/services"; -import { WrapperNodeApi, NodeIQQNTWrapperSession } from "@/core/wrapper/wrapper"; -import { NapCatOneBot11Adapter } from "@/onebot/main"; -import { sleep } from "@/common/utils/helper"; +import { NapCatPathWrapper } from '@/common/framework/napcat'; +import { LogWrapper } from '@/common/utils/log'; +import { proxiedListenerOf } from '@/common/utils/proxy-handler'; +import { QQBasicInfoWrapper } from '@/common/utils/QQBasicInfo'; +import { loadQQWrapper, NapCatCore, NapCatCoreWorkingEnv } from '@/core/core'; +import { InstanceContext } from '@/core'; +import { SelfInfo } from '@/core/entities'; +import { LoginListener } from '@/core/listeners'; +import { NodeIKernelLoginService } from '@/core/services'; +import { NodeIQQNTWrapperSession, WrapperNodeApi } from '@/core/wrapper/wrapper'; +import { NapCatOneBot11Adapter } from '@/onebot/main'; //Framework ES入口文件 export async function NCoreInitFramework( session: NodeIQQNTWrapperSession, loginService: NodeIKernelLoginService, - registerInitCallback: (callback: () => void) => void + registerInitCallback: (callback: () => void) => void, ) { //在进入本层前是否登录未进行判断 - console.log("NapCat Framework App Loading..."); + console.log('NapCat Framework App Loading...'); const pathWrapper = new NapCatPathWrapper(); const logger = new LogWrapper(pathWrapper.logsPath); const basicInfoWrapper = new QQBasicInfoWrapper({ logger }); @@ -62,7 +61,7 @@ export class NapCatFramework { loginService: NodeIKernelLoginService, selfInfo: SelfInfo, basicInfoWrapper: QQBasicInfoWrapper, - pathWrapper: NapCatPathWrapper + pathWrapper: NapCatPathWrapper, ) { this.context = { workingEnv: NapCatCoreWorkingEnv.Framework, @@ -71,7 +70,7 @@ export class NapCatFramework { logger, loginService, basicInfoWrapper, - pathWrapper + pathWrapper, }; this.core = new NapCatCore(this.context, selfInfo); } diff --git a/src/onebot/action/BaseAction.ts b/src/onebot/action/BaseAction.ts index 03e23bc1..90990eb2 100644 --- a/src/onebot/action/BaseAction.ts +++ b/src/onebot/action/BaseAction.ts @@ -11,10 +11,12 @@ class BaseAction { private validate: undefined | ValidateFunction = undefined; PayloadSchema: any = undefined; OneBotContext: NapCatOneBot11Adapter; - constructor(onebotContext:NapCatOneBot11Adapter,coreContext: NapCatCore) { + + constructor(onebotContext: NapCatOneBot11Adapter, coreContext: NapCatCore) { this.OneBotContext = onebotContext; this.CoreContext = coreContext; } + protected async check(payload: PayloadType): Promise { if (this.PayloadSchema) { this.validate = new Ajv({ allowUnionTypes: true }).compile(this.PayloadSchema); @@ -26,11 +28,11 @@ class BaseAction { }); return { valid: false, - message: errorMessages.join('\n') as string || '未知错误' + message: errorMessages.join('\n') as string || '未知错误', }; } return { - valid: true + valid: true, }; } diff --git a/src/onebot/action/OB11Response.ts b/src/onebot/action/OB11Response.ts index 26d29464..aec721b7 100644 --- a/src/onebot/action/OB11Response.ts +++ b/src/onebot/action/OB11Response.ts @@ -10,7 +10,7 @@ export class OB11Response { data: data, message: message, wording: message, - echo: null + echo: null, }; } diff --git a/src/onebot/action/extends/CreateCollection.ts b/src/onebot/action/extends/CreateCollection.ts index dc4dec5c..31ead457 100644 --- a/src/onebot/action/extends/CreateCollection.ts +++ b/src/onebot/action/extends/CreateCollection.ts @@ -1,11 +1,12 @@ import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + const SchemaData = { type: 'object', properties: { rawData: { type: 'string' }, - brief: { type: 'string' } + brief: { type: 'string' }, }, required: ['brief', 'rawData'], } as const satisfies JSONSchema; @@ -15,12 +16,13 @@ type Payload = FromSchema; export class CreateCollection extends BaseAction { actionName = ActionName.CreateCollection; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { return await this.CoreContext.getApiContext().CollectionApi.createCollection( this.CoreContext.selfInfo.uin, this.CoreContext.selfInfo.uid, this.CoreContext.selfInfo.nick, - payload.brief, payload.rawData + payload.brief, payload.rawData, ); } } diff --git a/src/onebot/action/extends/FetchCustomFace.ts b/src/onebot/action/extends/FetchCustomFace.ts index 89ccdcf5..0ec29fcc 100644 --- a/src/onebot/action/extends/FetchCustomFace.ts +++ b/src/onebot/action/extends/FetchCustomFace.ts @@ -1,11 +1,12 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; + const SchemaData = { type: 'object', properties: { count: { type: 'number' }, - } + }, } as const satisfies JSONSchema; type Payload = FromSchema; @@ -13,8 +14,9 @@ type Payload = FromSchema; export class FetchCustomFace extends BaseAction { actionName = ActionName.FetchCustomFace; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { - //48 可能正好是QQ需要的一个页面的数量 Tagged Mlikiowa + //48 可能正好是QQ需要的一个页面的数量 Tagged Mlikiowa const ret = await this.CoreContext.getApiContext().MsgApi.fetchFavEmojiList(payload.count || 48); return ret.emojiInfoList.map(e => e.url); } diff --git a/src/onebot/action/extends/FetchEmojiLike.ts b/src/onebot/action/extends/FetchEmojiLike.ts index f61cc5e5..6939021d 100644 --- a/src/onebot/action/extends/FetchEmojiLike.ts +++ b/src/onebot/action/extends/FetchEmojiLike.ts @@ -12,9 +12,9 @@ const SchemaData = { emojiId: { type: 'string' }, emojiType: { type: 'string' }, message_id: { type: ['string', 'number'] }, - count: { type: 'number' } + count: { type: 'number' }, }, - required: ['emojiId', 'emojiType', 'message_id'] + required: ['emojiId', 'emojiType', 'message_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -22,10 +22,11 @@ type Payload = FromSchema; export class FetchEmojiLike extends BaseAction { actionName = ActionName.FetchEmojiLike; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const msgIdPeer = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); - if(!msgIdPeer) throw new Error('消息不存在'); + if (!msgIdPeer) throw new Error('消息不存在'); const msg = (await NTQQMsgApi.getMsgsByMsgId(msgIdPeer.Peer, [msgIdPeer.MsgId])).msgList[0]; return await NTQQMsgApi.getMsgEmojiLikesList(msgIdPeer.Peer, msg.msgSeq, payload.emojiId, payload.emojiType, payload.count); } diff --git a/src/onebot/action/extends/GetCollectionList.ts b/src/onebot/action/extends/GetCollectionList.ts index ab2a868a..3251b2f3 100644 --- a/src/onebot/action/extends/GetCollectionList.ts +++ b/src/onebot/action/extends/GetCollectionList.ts @@ -1,4 +1,3 @@ - import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; @@ -7,7 +6,7 @@ const SchemaData = { type: 'object', properties: { category: { type: 'number' }, - count: { type: 'number' } + count: { type: 'number' }, }, required: ['category', 'count'], } as const satisfies JSONSchema; @@ -17,6 +16,7 @@ type Payload = FromSchema; export class GetCollectionList extends BaseAction { actionName = ActionName.GetCollectionList; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQCollectionApi = this.CoreContext.getApiContext().CollectionApi; return await NTQQCollectionApi.getAllCollection(payload.category, payload.count); diff --git a/src/onebot/action/extends/GetFriendWithCategory.ts b/src/onebot/action/extends/GetFriendWithCategory.ts index fcc87086..4b19fba8 100644 --- a/src/onebot/action/extends/GetFriendWithCategory.ts +++ b/src/onebot/action/extends/GetFriendWithCategory.ts @@ -1,4 +1,3 @@ - import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { OB11Constructor } from '@/onebot/helper/constructor'; diff --git a/src/onebot/action/extends/GetGroupAddRequest.ts b/src/onebot/action/extends/GetGroupAddRequest.ts index d9167328..ce108f17 100644 --- a/src/onebot/action/extends/GetGroupAddRequest.ts +++ b/src/onebot/action/extends/GetGroupAddRequest.ts @@ -1,11 +1,10 @@ import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQGroupApi } from '@/core/apis/group'; interface OB11GroupRequestNotify { - group_id: number, - user_id: number, - flag: string + group_id: number, + user_id: number, + flag: string } export default class GetGroupAddRequest extends BaseAction { diff --git a/src/onebot/action/extends/GetProfileLike.ts b/src/onebot/action/extends/GetProfileLike.ts index 984a0469..09ad5fb9 100644 --- a/src/onebot/action/extends/GetProfileLike.ts +++ b/src/onebot/action/extends/GetProfileLike.ts @@ -1,7 +1,9 @@ import BaseAction from '../BaseAction'; import { ActionName } from '../types'; + export class GetProfileLike extends BaseAction { actionName = ActionName.GetProfileLike; + protected async _handle(payload: void) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const ret = await NTQQUserApi.getProfileLike(this.CoreContext.selfInfo.uid); diff --git a/src/onebot/action/extends/GetRobotUinRange.ts b/src/onebot/action/extends/GetRobotUinRange.ts index e887c5cc..a3d47d22 100644 --- a/src/onebot/action/extends/GetRobotUinRange.ts +++ b/src/onebot/action/extends/GetRobotUinRange.ts @@ -1,11 +1,11 @@ import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQUserApi } from '@/core/apis'; + export class GetRobotUinRange extends BaseAction> { actionName = ActionName.GetRobotUinRange; protected async _handle(payload: void) { - // console.log(await NTQQUserApi.getRobotUinRange()); + // console.log(await NTQQUserApi.getRobotUinRange()); const NTQQUserApi = this.CoreContext.getApiContext().UserApi; return await NTQQUserApi.getRobotUinRange(); } diff --git a/src/onebot/action/extends/OCRImage.ts b/src/onebot/action/extends/OCRImage.ts index 07b9a857..7eda4d6b 100644 --- a/src/onebot/action/extends/OCRImage.ts +++ b/src/onebot/action/extends/OCRImage.ts @@ -9,7 +9,7 @@ const SchemaData = { properties: { image: { type: 'string' }, }, - required: ['image'] + required: ['image'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -17,9 +17,10 @@ type Payload = FromSchema; export class OCRImage extends BaseAction { actionName = ActionName.OCRImage; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQSystemApi = this.CoreContext.getApiContext().SystemApi; - const { path, isLocal, errMsg,success } = (await uri2local(this.CoreContext.NapCatTempPath,payload.image)); + const { path, isLocal, errMsg, success } = (await uri2local(this.CoreContext.NapCatTempPath, payload.image)); if (!success) { throw `OCR ${payload.image}失败,image字段可能格式不正确`; } @@ -27,7 +28,8 @@ export class OCRImage extends BaseAction { await checkFileReceived(path, 5000); // 文件不存在QQ会崩溃,需要提前判断 const ret = await NTQQSystemApi.ORCImage(path); if (!isLocal) { - fs.unlink(path, () => { }); + fs.unlink(path, () => { + }); } if (!ret) { throw `OCR ${payload.file}失败`; @@ -35,11 +37,13 @@ export class OCRImage extends BaseAction { return ret.result; } if (!isLocal) { - fs.unlink(path, () => { }); + fs.unlink(path, () => { + }); } throw `OCR ${payload.file}失败,文件可能不存在`; } } + export class IOCRImage extends OCRImage { actionName = ActionName.IOCRImage; } diff --git a/src/onebot/action/extends/SetGroupHeader.ts b/src/onebot/action/extends/SetGroupHeader.ts index fc7322a3..c9b7a91e 100644 --- a/src/onebot/action/extends/SetGroupHeader.ts +++ b/src/onebot/action/extends/SetGroupHeader.ts @@ -1,17 +1,18 @@ import BaseAction from '../BaseAction'; import { ActionName, BaseCheckResult } from '../types'; import * as fs from 'node:fs'; -import { NTQQUserApi } from '@/core/apis/user'; import { checkFileReceived, uri2local } from '@/common/utils/file'; + // import { log } from "../../../common/utils"; interface Payload { - file: string, - groupCode: string + file: string, + groupCode: string } export default class SetGroupHeader extends BaseAction { actionName = ActionName.SetGroupHeader; + // 用不着复杂检测 protected async check(payload: Payload): Promise { if (!payload.file || typeof payload.file != 'string' || !payload.groupCode || typeof payload.groupCode != 'string') { @@ -24,6 +25,7 @@ export default class SetGroupHeader extends BaseAction { valid: true, }; } + protected async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const { path, isLocal, errMsg, success } = (await uri2local(this.CoreContext.NapCatTempPath, payload.file)); @@ -34,7 +36,8 @@ export default class SetGroupHeader extends BaseAction { await checkFileReceived(path, 5000); // 文件不存在QQ会崩溃,需要提前判断 const ret = await NTQQGroupApi.setGroupAvatar(payload.groupCode, path); if (!isLocal) { - fs.unlink(path, () => { }); + fs.unlink(path, () => { + }); } if (!ret) { throw `头像${payload.file}设置失败,api无返回`; @@ -48,7 +51,8 @@ export default class SetGroupHeader extends BaseAction { return ret; } else { if (!isLocal) { - fs.unlink(path, () => { }); + fs.unlink(path, () => { + }); } throw `头像${payload.file}设置失败,无法获取头像,文件可能不存在`; } diff --git a/src/onebot/action/extends/SetLongNick.ts b/src/onebot/action/extends/SetLongNick.ts index 22f9356d..61322760 100644 --- a/src/onebot/action/extends/SetLongNick.ts +++ b/src/onebot/action/extends/SetLongNick.ts @@ -1,7 +1,5 @@ - import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQUserApi } from '@/core/apis'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { @@ -9,7 +7,7 @@ const SchemaData = { properties: { longNick: { type: 'string' }, }, - required: [ 'longNick'], + required: ['longNick'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -17,6 +15,7 @@ type Payload = FromSchema; export class SetLongNick extends BaseAction { actionName = ActionName.SetLongNick; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const ret = await NTQQUserApi.setLongNick(payload.longNick); diff --git a/src/onebot/action/extends/SetOnlineStatus.ts b/src/onebot/action/extends/SetOnlineStatus.ts index 86a81933..d7c3a7c1 100644 --- a/src/onebot/action/extends/SetOnlineStatus.ts +++ b/src/onebot/action/extends/SetOnlineStatus.ts @@ -1,6 +1,5 @@ import BaseAction from '../BaseAction'; -import { ActionName, BaseCheckResult } from '../types'; -import { NTQQUserApi } from '@/core/apis'; +import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; // 设置在线状态 @@ -9,7 +8,7 @@ const SchemaData = { properties: { status: { type: 'number' }, extStatus: { type: 'number' }, - batteryStatus: { type: 'number' } + batteryStatus: { type: 'number' }, }, required: ['status', 'extStatus', 'batteryStatus'], } as const satisfies JSONSchema; @@ -19,13 +18,14 @@ type Payload = FromSchema; export class SetOnlineStatus extends BaseAction { actionName = ActionName.SetOnlineStatus; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { - // 可设置状态 - // { status: 10, extStatus: 1027, batteryStatus: 0 } - // { status: 30, extStatus: 0, batteryStatus: 0 } - // { status: 50, extStatus: 0, batteryStatus: 0 } - // { status: 60, extStatus: 0, batteryStatus: 0 } - // { status: 70, extStatus: 0, batteryStatus: 0 } + // 可设置状态 + // { status: 10, extStatus: 1027, batteryStatus: 0 } + // { status: 30, extStatus: 0, batteryStatus: 0 } + // { status: 50, extStatus: 0, batteryStatus: 0 } + // { status: 60, extStatus: 0, batteryStatus: 0 } + // { status: 70, extStatus: 0, batteryStatus: 0 } const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const ret = await NTQQUserApi.setSelfOnlineStatus(payload.status, payload.extStatus, payload.batteryStatus); if (ret.result !== 0) { diff --git a/src/onebot/action/extends/SetQQAvatar.ts b/src/onebot/action/extends/SetQQAvatar.ts index b3cea0d1..16eb22bd 100644 --- a/src/onebot/action/extends/SetQQAvatar.ts +++ b/src/onebot/action/extends/SetQQAvatar.ts @@ -2,12 +2,14 @@ import BaseAction from '../BaseAction'; import { ActionName, BaseCheckResult } from '../types'; import * as fs from 'node:fs'; import { checkFileReceived, uri2local } from '@/common/utils/file'; + interface Payload { - file: string + file: string; } export default class SetAvatar extends BaseAction { actionName = ActionName.SetQQAvatar; + // 用不着复杂检测 protected async check(payload: Payload): Promise { if (!payload.file || typeof payload.file != 'string') { @@ -20,6 +22,7 @@ export default class SetAvatar extends BaseAction { valid: true, }; } + protected async _handle(payload: Payload): Promise { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const { path, isLocal, errMsg, success } = (await uri2local(this.CoreContext.NapCatTempPath, payload.file)); @@ -30,7 +33,8 @@ export default class SetAvatar extends BaseAction { await checkFileReceived(path, 5000); // 文件不存在QQ会崩溃,需要提前判断 const ret = await NTQQUserApi.setQQAvatar(path); if (!isLocal) { - fs.unlink(path, () => { }); + fs.unlink(path, () => { + }); } if (!ret) { throw `头像${payload.file}设置失败,api无返回`; @@ -43,7 +47,8 @@ export default class SetAvatar extends BaseAction { } } else { if (!isLocal) { - fs.unlink(path, () => { }); + fs.unlink(path, () => { + }); } throw `头像${payload.file}设置失败,无法获取头像,文件可能不存在`; } diff --git a/src/onebot/action/extends/SetSelfProfile.ts b/src/onebot/action/extends/SetSelfProfile.ts index 1860b8b9..2ce5acb1 100644 --- a/src/onebot/action/extends/SetSelfProfile.ts +++ b/src/onebot/action/extends/SetSelfProfile.ts @@ -1,4 +1,3 @@ - import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; @@ -8,7 +7,7 @@ const SchemaData = { properties: { nick: { type: 'string' }, longNick: { type: 'string' }, - sex: { type: 'number' }//传Sex值?建议传0 + sex: { type: 'number' },//传Sex值?建议传0 }, required: ['nick', 'longNick', 'sex'], } as const satisfies JSONSchema; @@ -18,6 +17,7 @@ type Payload = FromSchema; export class SetSelfProfile extends BaseAction { actionName = ActionName.SetSelfProfile; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const ret = await NTQQUserApi.modifySelfProfile({ @@ -25,7 +25,7 @@ export class SetSelfProfile extends BaseAction { longNick: payload.longNick, sex: payload.sex, birthday: { birthday_year: '', birthday_month: '', birthday_day: '' }, - location: undefined + location: undefined, }); return ret; } diff --git a/src/onebot/action/extends/TranslateEnWordToZn.ts b/src/onebot/action/extends/TranslateEnWordToZn.ts index 381163b7..9b50848f 100644 --- a/src/onebot/action/extends/TranslateEnWordToZn.ts +++ b/src/onebot/action/extends/TranslateEnWordToZn.ts @@ -1,6 +1,5 @@ import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQSystemApi } from '@/core/apis'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { @@ -8,8 +7,8 @@ const SchemaData = { properties: { words: { type: 'array', - items: { type: 'string' } - } + items: { type: 'string' }, + }, }, required: ['words'], } as const satisfies JSONSchema; @@ -19,6 +18,7 @@ type Payload = FromSchema; export class TranslateEnWordToZn extends BaseAction | null> { actionName = ActionName.TranslateEnWordToZn; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQSystemApi = this.CoreContext.getApiContext().SystemApi; const ret = await NTQQSystemApi.translateEnWordToZn(payload.words); diff --git a/src/onebot/action/extends/sharePeer.ts b/src/onebot/action/extends/sharePeer.ts index 91e576fa..bac92b2c 100644 --- a/src/onebot/action/extends/sharePeer.ts +++ b/src/onebot/action/extends/sharePeer.ts @@ -17,6 +17,7 @@ type Payload = FromSchema; export class sharePeer extends BaseAction { actionName = ActionName.SharePeer; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; @@ -27,20 +28,23 @@ export class sharePeer extends BaseAction { } } } + const SchemaDataGroupEx = { type: 'object', properties: { group_id: { type: 'string' }, }, - required: ['group_id'] + required: ['group_id'], } as const satisfies JSONSchema; type PayloadGroupEx = FromSchema; + export class shareGroupEx extends BaseAction { actionName = ActionName.ShareGroupEx; PayloadSchema = SchemaDataGroupEx; + protected async _handle(payload: PayloadGroupEx) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; return await NTQQGroupApi.getArkJsonGroupShare(payload.group_id); } -} \ No newline at end of file +} diff --git a/src/onebot/action/file/DelGroupFile.ts b/src/onebot/action/file/DelGroupFile.ts index 2f805fa0..601ee275 100644 --- a/src/onebot/action/file/DelGroupFile.ts +++ b/src/onebot/action/file/DelGroupFile.ts @@ -1,13 +1,14 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; + const SchemaData = { type: 'object', properties: { group_id: { type: ['string', 'number'] }, file_id: { type: 'string' }, }, - required: ['group_id', 'file_id'] + required: ['group_id', 'file_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -15,6 +16,7 @@ type Payload = FromSchema; export class DelGroupFile extends BaseAction { actionName = ActionName.DelGroupFile; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; return await NTQQGroupApi.DelGroupFile(payload.group_id.toString(), [payload.file_id]); diff --git a/src/onebot/action/file/DelGroupFileFolder.ts b/src/onebot/action/file/DelGroupFileFolder.ts index 3a9ad509..51907876 100644 --- a/src/onebot/action/file/DelGroupFileFolder.ts +++ b/src/onebot/action/file/DelGroupFileFolder.ts @@ -1,7 +1,6 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQGroupApi, NTQQMsgApi, NTQQUserApi } from '@/core/apis'; const SchemaData = { type: 'object', @@ -9,7 +8,7 @@ const SchemaData = { group_id: { type: ['string', 'number'] }, folder_id: { type: 'string' }, }, - required: ['group_id', 'folder_id'] + required: ['group_id', 'folder_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -17,6 +16,7 @@ type Payload = FromSchema; export class DelGroupFileFolder extends BaseAction { actionName = ActionName.DelGroupFileFolder; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; return (await NTQQGroupApi.DelGroupFileFolder(payload.group_id.toString(), payload.folder_id)).groupFileCommonResult; diff --git a/src/onebot/action/file/GetFile.ts b/src/onebot/action/file/GetFile.ts index 7068aae3..ecc9d3a6 100644 --- a/src/onebot/action/file/GetFile.ts +++ b/src/onebot/action/file/GetFile.ts @@ -6,26 +6,28 @@ import { ChatType, ElementType, FileElement, Peer, RawMessage, VideoElement } fr import { FromSchema, JSONSchema } from 'json-schema-to-ts'; export interface GetFilePayload { - file: string; // 文件名或者fileUuid + file: string; // 文件名或者fileUuid } export interface GetFileResponse { - file?: string; // path - url?: string; - file_size?: string; - file_name?: string; - base64?: string; + file?: string; // path + url?: string; + file_size?: string; + file_name?: string; + base64?: string; } + const GetFileBase_PayloadSchema = { type: 'object', properties: { - file: { type: 'string' } + file: { type: 'string' }, }, - required: ['file'] + required: ['file'], } as const satisfies JSONSchema; export class GetFileBase extends BaseAction { PayloadSchema: any = GetFileBase_PayloadSchema; + private getElement(msg: RawMessage): { id: string, element: VideoElement | FileElement } { let element = msg.elements.find(e => e.fileElement); if (!element) { @@ -38,6 +40,7 @@ export class GetFileBase extends BaseAction { } return { id: element.elementId, element: element.fileElement }; } + protected async _handle(payload: GetFilePayload): Promise { const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi; const NTQQUserApi = this.CoreContext.getApiContext().UserApi; @@ -45,9 +48,9 @@ export class GetFileBase extends BaseAction { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const NTQQFileApi = this.CoreContext.getApiContext().FileApi; let UuidData: { - high: string; - low: string; - } | undefined; + high: string; + low: string; + } | undefined; try { UuidData = UUIDConverter.decode(payload.file); if (UuidData) { @@ -87,7 +90,7 @@ export class GetFileBase extends BaseAction { file: downloadPath, url: downloadPath, file_size: fileSize, - file_name: fileName + file_name: fileName, }; if (true/*enableLocalFile2Url*/) { try { @@ -127,7 +130,7 @@ export class GetFileBase extends BaseAction { file: downloadPath, url: downloadPath, file_size: NTSearchNameResult[0].fileSize.toString(), - file_name: NTSearchNameResult[0].fileName + file_name: NTSearchNameResult[0].fileName, }; if (true/*enableLocalFile2Url*/) { try { @@ -182,24 +185,24 @@ export class GetFileBase extends BaseAction { // // } // } - // } - // // log('file found', cache); - // const res: GetFileResponse = { - // file: cache.path, - // url: cache.url, - // file_size: cache.size.toString(), - // file_name: cache.name - // }; - // if (enableLocalFile2Url) { - // if (!cache.url) { - // try { - // res.base64 = await fs.readFile(cache.path, 'base64'); - // } catch (e) { - // throw new Error('文件下载失败. ' + e); - // } - // } - // } - //return res; + // } + // // log('file found', cache); + // const res: GetFileResponse = { + // file: cache.path, + // url: cache.url, + // file_size: cache.size.toString(), + // file_name: cache.name + // }; + // if (enableLocalFile2Url) { + // if (!cache.url) { + // try { + // res.base64 = await fs.readFile(cache.path, 'base64'); + // } catch (e) { + // throw new Error('文件下载失败. ' + e); + // } + // } + // } + //return res; } } @@ -207,20 +210,21 @@ const GetFile_PayloadSchema = { type: 'object', properties: { file_id: { type: 'string' }, - file: { type: 'string' } + file: { type: 'string' }, }, - required: ['file_id'] + required: ['file_id'], } as const satisfies JSONSchema; type GetFile_Payload_Internal = FromSchema; interface GetFile_Payload extends GetFile_Payload_Internal { - file: string + file: string; } export default class GetFile extends GetFileBase { actionName = ActionName.GetFile; PayloadSchema = GetFile_PayloadSchema; + protected async _handle(payload: GetFile_Payload): Promise { payload.file = payload.file_id; return super._handle(payload); diff --git a/src/onebot/action/file/GetGroupFileCount.ts b/src/onebot/action/file/GetGroupFileCount.ts index 8c150dbd..ba77b442 100644 --- a/src/onebot/action/file/GetGroupFileCount.ts +++ b/src/onebot/action/file/GetGroupFileCount.ts @@ -1,14 +1,13 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQGroupApi, NTQQUserApi } from '@/core/apis'; const SchemaData = { type: 'object', properties: { group_id: { type: ['string', 'number'] }, }, - required: ['group_id'] + required: ['group_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -16,6 +15,7 @@ type Payload = FromSchema; export class GetGroupFileCount extends BaseAction { actionName = ActionName.GetGroupFileCount; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const ret = await NTQQGroupApi.GetGroupFileCount([payload.group_id?.toString()]); diff --git a/src/onebot/action/file/GetGroupFileList.ts b/src/onebot/action/file/GetGroupFileList.ts index c02f74bf..24628fd5 100644 --- a/src/onebot/action/file/GetGroupFileList.ts +++ b/src/onebot/action/file/GetGroupFileList.ts @@ -1,6 +1,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; + const SchemaData = { type: 'object', properties: { @@ -8,7 +9,7 @@ const SchemaData = { start_index: { type: 'number' }, file_count: { type: 'number' }, }, - required: ['group_id', 'start_index', 'file_count'] + required: ['group_id', 'start_index', 'file_count'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -16,6 +17,7 @@ type Payload = FromSchema; export class GetGroupFileList extends BaseAction }> { actionName = ActionName.GetGroupFileList; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const ret = await NTQQMsgApi.getGroupFileList(payload.group_id.toString(), { @@ -23,8 +25,10 @@ export class GetGroupFileList extends BaseAction fileCount: payload.file_count, startIndex: payload.start_index, sortOrder: 2, - showOnlinedocFolder: 0 - }).catch((e) => { return []; }); + showOnlinedocFolder: 0, + }).catch((e) => { + return []; + }); return { FileList: ret }; } } diff --git a/src/onebot/action/file/GetRecord.ts b/src/onebot/action/file/GetRecord.ts index cea9ecd5..882472d1 100644 --- a/src/onebot/action/file/GetRecord.ts +++ b/src/onebot/action/file/GetRecord.ts @@ -2,7 +2,7 @@ import { GetFileBase, GetFilePayload, GetFileResponse } from './GetFile'; import { ActionName } from '../types'; interface Payload extends GetFilePayload { - out_format: 'mp3' | 'amr' | 'wma' | 'm4a' | 'spx' | 'ogg' | 'wav' | 'flac' + out_format: 'mp3' | 'amr' | 'wma' | 'm4a' | 'spx' | 'ogg' | 'wav' | 'flac'; } export default class GetRecord extends GetFileBase { @@ -12,4 +12,4 @@ export default class GetRecord extends GetFileBase { const res = super._handle(payload); return res; } -} \ No newline at end of file +} diff --git a/src/onebot/action/file/SetGroupFileFolder.ts b/src/onebot/action/file/SetGroupFileFolder.ts index 3442565b..4caa27b3 100644 --- a/src/onebot/action/file/SetGroupFileFolder.ts +++ b/src/onebot/action/file/SetGroupFileFolder.ts @@ -1,13 +1,14 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; + const SchemaData = { type: 'object', properties: { group_id: { type: ['string', 'number'] }, folder_name: { type: 'string' }, }, - required: ['group_id', 'folder_name'] + required: ['group_id', 'folder_name'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -15,6 +16,7 @@ type Payload = FromSchema; export class SetGroupFileFolder extends BaseAction { actionName = ActionName.SetGroupFileFolder; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; return (await NTQQGroupApi.CreatGroupFileFolder(payload.group_id.toString(), payload.folder_name)).resultWithGroupItem; diff --git a/src/onebot/action/go-cqhttp/DownloadFile.ts b/src/onebot/action/go-cqhttp/DownloadFile.ts index e4bb4761..37b8d39c 100644 --- a/src/onebot/action/go-cqhttp/DownloadFile.ts +++ b/src/onebot/action/go-cqhttp/DownloadFile.ts @@ -5,9 +5,11 @@ import { join as joinPath } from 'node:path'; import { calculateFileMD5, httpDownload } from '@/common/utils/file'; import { randomUUID } from 'crypto'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + interface FileResponse { - file: string; + file: string; } + const SchemaData = { type: 'object', properties: { @@ -18,9 +20,9 @@ const SchemaData = { headers: { type: ['string', 'array'], items: { - type: 'string' - } - } + type: 'string', + }, + }, }, } as const satisfies JSONSchema; @@ -29,6 +31,7 @@ type Payload = FromSchema; export default class GoCQHTTPDownloadFile extends BaseAction { actionName = ActionName.GoCQHTTP_DownloadFile; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const isRandomName = !payload.name; const name = payload.name || randomUUID(); diff --git a/src/onebot/action/go-cqhttp/GetForwardMsg.ts b/src/onebot/action/go-cqhttp/GetForwardMsg.ts index a6f20799..a073870a 100644 --- a/src/onebot/action/go-cqhttp/GetForwardMsg.ts +++ b/src/onebot/action/go-cqhttp/GetForwardMsg.ts @@ -1,8 +1,7 @@ import BaseAction from '../BaseAction'; import { OB11ForwardMessage, OB11Message, OB11MessageData } from '../../types'; -import { NTQQMsgApi } from '@/core/apis'; import { OB11Constructor } from '../../helper/data'; -import { ActionName, BaseCheckResult } from '../types'; +import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { MessageUnique } from '@/common/utils/MessageUnique'; @@ -10,19 +9,20 @@ const SchemaData = { type: 'object', properties: { message_id: { type: 'string' }, - id: { type: 'string' } + id: { type: 'string' }, }, } as const satisfies JSONSchema; type Payload = FromSchema; interface Response { - messages: (OB11Message & { content: OB11MessageData })[]; + messages: (OB11Message & { content: OB11MessageData })[]; } export class GoCQHTTPGetForwardMsgAction extends BaseAction { actionName = ActionName.GoCQHTTP_GetForwardMsg; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const msgId = payload.message_id || payload.id; @@ -40,8 +40,12 @@ export class GoCQHTTPGetForwardMsgAction extends BaseAction { } const msgList = data.msgList; const messages = await Promise.all(msgList.map(async msg => { - const resMsg = await OB11Constructor.message(this.CoreContext, msg, "array"); - resMsg.message_id = MessageUnique.createMsg({ guildId: '', chatType: msg.chatType, peerUid: msg.peerUid }, msg.msgId)!; + const resMsg = await OB11Constructor.message(this.CoreContext, msg, 'array'); + resMsg.message_id = MessageUnique.createMsg({ + guildId: '', + chatType: msg.chatType, + peerUid: msg.peerUid, + }, msg.msgId)!; return resMsg; })); messages.map(msg => { diff --git a/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts b/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts index 61cafa72..972f5837 100644 --- a/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts +++ b/src/onebot/action/go-cqhttp/GetFriendMsgHistory.ts @@ -1,14 +1,13 @@ import BaseAction from '../BaseAction'; -import { OB11Message, OB11User } from '../../types'; +import { OB11Message } from '../../types'; import { ActionName } from '../types'; import { ChatType, RawMessage } from '@/core/entities'; -import { NTQQMsgApi } from '@/core/apis/msg'; import { OB11Constructor } from '../../helper/data'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { MessageUnique } from '@/common/utils/MessageUnique'; interface Response { - messages: OB11Message[]; + messages: OB11Message[]; } const SchemaData = { @@ -17,9 +16,9 @@ const SchemaData = { user_id: { type: ['number', 'string'] }, message_seq: { type: 'number' }, count: { type: 'number' }, - reverseOrder: { type: 'boolean' } + reverseOrder: { type: 'boolean' }, }, - required: ['user_id'] + required: ['user_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -27,6 +26,7 @@ type Payload = FromSchema; export default class GetFriendMsgHistory extends BaseAction { actionName = ActionName.GetFriendMsgHistory; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; @@ -53,7 +53,7 @@ export default class GetFriendMsgHistory extends BaseAction { msg.id = MessageUnique.createMsg({ guildId: '', chatType: msg.chatType, peerUid: msg.peerUid }, msg.msgId); })); //转换消息 - const ob11MsgList = await Promise.all(msgList.map(msg => OB11Constructor.message(this.CoreContext, msg, "array"))); + const ob11MsgList = await Promise.all(msgList.map(msg => OB11Constructor.message(this.CoreContext, msg, 'array'))); return { 'messages': ob11MsgList }; } } diff --git a/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts b/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts index d5e50387..7d96dad3 100644 --- a/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts +++ b/src/onebot/action/go-cqhttp/GetGroupHonorInfo.ts @@ -1,15 +1,15 @@ - import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { WebHonorType } from '@/core/entities'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + const SchemaData = { type: 'object', properties: { - group_id: { type: [ 'number' , 'string' ] }, - type: { enum: [WebHonorType.ALL, WebHonorType.EMOTION, WebHonorType.LEGEND, WebHonorType.PERFORMER, WebHonorType.STRONG_NEWBIE, WebHonorType.TALKATIVE] } + group_id: { type: ['number', 'string'] }, + type: { enum: [WebHonorType.ALL, WebHonorType.EMOTION, WebHonorType.LEGEND, WebHonorType.PERFORMER, WebHonorType.STRONG_NEWBIE, WebHonorType.TALKATIVE] }, }, - required: ['group_id'] + required: ['group_id'], } as const satisfies JSONSchema; // enum是不是有点抽象 type Payload = FromSchema; @@ -17,6 +17,7 @@ type Payload = FromSchema; export class GetGroupHonorInfo extends BaseAction> { actionName = ActionName.GetGroupHonorInfo; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { if (!payload.type) { payload.type = WebHonorType.ALL; diff --git a/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts b/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts index 6f352444..68f47856 100644 --- a/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts +++ b/src/onebot/action/go-cqhttp/GetGroupMsgHistory.ts @@ -5,8 +5,9 @@ import { ChatType, Peer, RawMessage } from '@/core/entities'; import { OB11Constructor } from '../../helper/data'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { MessageUnique } from '@/common/utils/MessageUnique'; + interface Response { - messages: OB11Message[]; + messages: OB11Message[]; } const SchemaData = { @@ -15,9 +16,9 @@ const SchemaData = { group_id: { type: ['number', 'string'] }, message_seq: { type: 'number' }, count: { type: 'number' }, - reverseOrder: { type: 'boolean' } + reverseOrder: { type: 'boolean' }, }, - required: ['group_id'] + required: ['group_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -25,6 +26,7 @@ type Payload = FromSchema; export default class GoCQHTTPGetGroupMsgHistory extends BaseAction { actionName = ActionName.GoCQHTTP_GetGroupMsgHistory; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; //处理参数 @@ -46,7 +48,7 @@ export default class GoCQHTTPGetGroupMsgHistory extends BaseAction OB11Constructor.message(this.CoreContext, msg, "array"))); + const ob11MsgList = await Promise.all(msgList.map(msg => OB11Constructor.message(this.CoreContext, msg, 'array'))); return { 'messages': ob11MsgList }; } } diff --git a/src/onebot/action/go-cqhttp/GetOnlineClient.ts b/src/onebot/action/go-cqhttp/GetOnlineClient.ts index 3e46b557..ce162ff8 100644 --- a/src/onebot/action/go-cqhttp/GetOnlineClient.ts +++ b/src/onebot/action/go-cqhttp/GetOnlineClient.ts @@ -7,18 +7,18 @@ const SchemaData = { type: 'object', properties: { no_cache: { type: 'boolean' }, - } + }, } as const satisfies JSONSchema; export class GetOnlineClient extends BaseAction> { actionName = ActionName.GetOnlineClient; protected async _handle(payload: void) { - //注册监听 + //注册监听 const NTQQSystemApi = this.CoreContext.getApiContext().SystemApi; NTQQSystemApi.getOnlineDev(); await sleep(500); - + return []; } } diff --git a/src/onebot/action/go-cqhttp/GetStrangerInfo.ts b/src/onebot/action/go-cqhttp/GetStrangerInfo.ts index 25003aca..f08a3ff7 100644 --- a/src/onebot/action/go-cqhttp/GetStrangerInfo.ts +++ b/src/onebot/action/go-cqhttp/GetStrangerInfo.ts @@ -4,12 +4,13 @@ import { OB11Constructor } from '../../helper/data'; import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { calcQQLevel } from '@/common/utils/helper'; + const SchemaData = { type: 'object', properties: { user_id: { type: ['number', 'string'] }, }, - required: ['user_id'] + required: ['user_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -32,7 +33,7 @@ export default class GoCQHTTPGetStrangerInfo extends BaseAction{ +export class GoCQHTTPHandleQuickAction extends BaseAction { actionName = ActionName.GoCQHTTP_HandleQuickAction; + protected async _handle(payload: Payload): Promise { - handleQuickOperation(this.CoreContext,payload.context, payload.operation).then().catch(this.CoreContext.context.logger.logError); + handleQuickOperation(this.CoreContext, payload.context, payload.operation).then().catch(this.CoreContext.context.logger.logError); return null; } -} \ No newline at end of file +} diff --git a/src/onebot/action/go-cqhttp/SendForwardMsg.ts b/src/onebot/action/go-cqhttp/SendForwardMsg.ts index 155276a3..a9372f88 100644 --- a/src/onebot/action/go-cqhttp/SendForwardMsg.ts +++ b/src/onebot/action/go-cqhttp/SendForwardMsg.ts @@ -1,6 +1,7 @@ import SendMsg, { normalize } from '../msg/SendMsg'; import { OB11PostSendMsg } from '../../types'; import { ActionName } from '../types'; + // 未验证 export class GoCQHTTPSendForwardMsg extends SendMsg { actionName = ActionName.GoCQHTTP_SendForwardMsg; diff --git a/src/onebot/action/go-cqhttp/SendGroupNotice.ts b/src/onebot/action/go-cqhttp/SendGroupNotice.ts index 751d95e1..14855949 100644 --- a/src/onebot/action/go-cqhttp/SendGroupNotice.ts +++ b/src/onebot/action/go-cqhttp/SendGroupNotice.ts @@ -3,6 +3,7 @@ import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { unlink } from 'node:fs'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + const SchemaData = { type: 'object', properties: { @@ -10,21 +11,27 @@ const SchemaData = { content: { type: 'string' }, image: { type: 'string' }, pinned: { type: 'number' }, - confirmRequired: { type: 'number' } + confirmRequired: { type: 'number' }, }, - required: ['group_id', 'content'] + required: ['group_id', 'content'], } as const satisfies JSONSchema; type Payload = FromSchema; export class SendGroupNotice extends BaseAction { actionName = ActionName.GoCQHTTP_SendGroupNotice; + protected async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; let UploadImage: { id: string, width: number, height: number } | undefined = undefined; if (payload.image) { //公告图逻辑 - const { errMsg, path, isLocal, success } = (await uri2local(this.CoreContext.NapCatTempPath,payload.image)); + const { + errMsg, + path, + isLocal, + success, + } = (await uri2local(this.CoreContext.NapCatTempPath, payload.image)); if (!success) { throw `群公告${payload.image}设置失败,image字段可能格式不正确`; } @@ -37,7 +44,8 @@ export class SendGroupNotice extends BaseAction { throw `群公告${payload.image}设置失败,图片上传失败`; } if (!isLocal) { - unlink(path, () => { }); + unlink(path, () => { + }); } UploadImage = ImageUploadResult.picInfo; } diff --git a/src/onebot/action/go-cqhttp/UploadGroupFile.ts b/src/onebot/action/go-cqhttp/UploadGroupFile.ts index f8df6a0d..1f13e26c 100644 --- a/src/onebot/action/go-cqhttp/UploadGroupFile.ts +++ b/src/onebot/action/go-cqhttp/UploadGroupFile.ts @@ -6,6 +6,7 @@ import { sendMsg } from '@/onebot/action/msg/SendMsg'; import { uri2local } from '@/common/utils/file'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { SendMsgElementConstructor } from '@/onebot/helper/msg'; + const SchemaData = { type: 'object', properties: { @@ -13,9 +14,9 @@ const SchemaData = { file: { type: 'string' }, name: { type: 'string' }, folder: { type: 'string' }, - folder_id: { type: 'string' }//临时扩展 + folder_id: { type: 'string' },//临时扩展 }, - required: ['group_id', 'file', 'name'] + required: ['group_id', 'file', 'name'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -23,6 +24,7 @@ type Payload = FromSchema; export default class GoCQHTTPUploadGroupFile extends BaseAction { actionName = ActionName.GoCQHTTP_UploadGroupFile; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { let file = payload.file; if (fs.existsSync(file)) { @@ -33,7 +35,10 @@ export default class GoCQHTTPUploadGroupFile extends BaseAction { throw new Error(downloadResult.errMsg); } const sendFileEle: SendFileElement = await SendMsgElementConstructor.file(this.CoreContext, downloadResult.path, payload.name, payload.folder_id); - await sendMsg(this.CoreContext, { chatType: ChatType.group, peerUid: payload.group_id.toString() }, [sendFileEle], [], true); + await sendMsg(this.CoreContext, { + chatType: ChatType.group, + peerUid: payload.group_id.toString(), + }, [sendFileEle], [], true); return null; } } diff --git a/src/onebot/action/go-cqhttp/UploadPrivareFile.ts b/src/onebot/action/go-cqhttp/UploadPrivareFile.ts index a1a01eab..3aee0e86 100644 --- a/src/onebot/action/go-cqhttp/UploadPrivareFile.ts +++ b/src/onebot/action/go-cqhttp/UploadPrivareFile.ts @@ -6,14 +6,15 @@ import { sendMsg } from '@/onebot/action/msg/SendMsg'; import { uri2local } from '@/common/utils/file'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { SendMsgElementConstructor } from '@/onebot/helper/msg'; + const SchemaData = { type: 'object', properties: { user_id: { type: ['number', 'string'] }, file: { type: 'string' }, - name: { type: 'string' } + name: { type: 'string' }, }, - required: ['user_id', 'file', 'name'] + required: ['user_id', 'file', 'name'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -21,6 +22,7 @@ type Payload = FromSchema; export default class GoCQHTTPUploadPrivateFile extends BaseAction { actionName = ActionName.GOCQHTTP_UploadPrivateFile; PayloadSchema = SchemaData; + async getPeer(payload: Payload): Promise { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi; @@ -34,6 +36,7 @@ export default class GoCQHTTPUploadPrivateFile extends BaseAction } throw '缺少参数 user_id'; } + protected async _handle(payload: Payload): Promise { const peer = await this.getPeer(payload); let file = payload.file; diff --git a/src/onebot/action/group/DelEssenceMsg.ts b/src/onebot/action/group/DelEssenceMsg.ts index 55f38087..e5f48a0a 100644 --- a/src/onebot/action/group/DelEssenceMsg.ts +++ b/src/onebot/action/group/DelEssenceMsg.ts @@ -1,4 +1,3 @@ - import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; @@ -7,9 +6,9 @@ import { MessageUnique } from '@/common/utils/MessageUnique'; const SchemaData = { type: 'object', properties: { - message_id: { type: ['number', 'string'] } + message_id: { type: ['number', 'string'] }, }, - required: ['message_id'] + required: ['message_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -17,6 +16,7 @@ type Payload = FromSchema; export default class DelEssenceMsg extends BaseAction { actionName = ActionName.DelEssenceMsg; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const msg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); @@ -25,7 +25,7 @@ export default class DelEssenceMsg extends BaseAction { } return await NTQQGroupApi.removeGroupEssence( msg.Peer.peerUid, - msg.MsgId + msg.MsgId, ); } } diff --git a/src/onebot/action/group/GetGroupEssence.ts b/src/onebot/action/group/GetGroupEssence.ts index e6d30a4c..00cce90f 100644 --- a/src/onebot/action/group/GetGroupEssence.ts +++ b/src/onebot/action/group/GetGroupEssence.ts @@ -6,10 +6,10 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { type: 'object', properties: { - group_id: { type: [ 'number' , 'string' ] }, + group_id: { type: ['number', 'string'] }, pages: { type: 'number' }, }, - required: ['group_id', 'pages'] + required: ['group_id', 'pages'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -17,6 +17,7 @@ type Payload = FromSchema; export class GetGroupEssence extends BaseAction { actionName = ActionName.GoCQHTTP_GetEssenceMsg; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQWebApi = this.CoreContext.getApiContext().WebApi; const ret = await NTQQWebApi.getGroupEssenceMsg(payload.group_id.toString(), payload.pages.toString()); diff --git a/src/onebot/action/group/GetGroupInfo.ts b/src/onebot/action/group/GetGroupInfo.ts index 4cd36a34..4f7cfee0 100644 --- a/src/onebot/action/group/GetGroupInfo.ts +++ b/src/onebot/action/group/GetGroupInfo.ts @@ -9,7 +9,7 @@ const SchemaData = { properties: { group_id: { type: ['number', 'string'] }, }, - required: ['group_id'] + required: ['group_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -17,6 +17,7 @@ type Payload = FromSchema; class GetGroupInfo extends BaseAction { actionName = ActionName.GetGroupInfo; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const group = (await NTQQGroupApi.getGroups()).find(e => e.groupCode == payload.group_id.toString()); diff --git a/src/onebot/action/group/GetGroupList.ts b/src/onebot/action/group/GetGroupList.ts index 1e2fa647..f09df6b3 100644 --- a/src/onebot/action/group/GetGroupList.ts +++ b/src/onebot/action/group/GetGroupList.ts @@ -9,7 +9,7 @@ const SchemaData = { type: 'object', properties: { no_cache: { type: ['boolean', 'string'] }, - } + }, } as const satisfies JSONSchema; type Payload = FromSchema; @@ -17,9 +17,10 @@ type Payload = FromSchema; class GetGroupList extends BaseAction { actionName = ActionName.GetGroupList; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; - const groupList: Group[] = await NTQQGroupApi.getGroups(payload?.no_cache === true || payload.no_cache === 'true'); + const groupList: Group[] = await NTQQGroupApi.getGroups(payload?.no_cache === true || payload.no_cache === 'true'); return OB11Constructor.groups(groupList); } } diff --git a/src/onebot/action/group/GetGroupMemberInfo.ts b/src/onebot/action/group/GetGroupMemberInfo.ts index 3b53fcb3..1231a126 100644 --- a/src/onebot/action/group/GetGroupMemberInfo.ts +++ b/src/onebot/action/group/GetGroupMemberInfo.ts @@ -3,6 +3,7 @@ import { OB11Constructor } from '../../helper/data'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + const SchemaData = { type: 'object', properties: { @@ -10,7 +11,7 @@ const SchemaData = { user_id: { type: ['number', 'string'] }, no_cache: { type: ['boolean', 'string'] }, }, - required: ['group_id', 'user_id'] + required: ['group_id', 'user_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -18,6 +19,7 @@ type Payload = FromSchema; class GetGroupMemberInfo extends BaseAction { actionName = ActionName.GetGroupMemberInfo; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; @@ -74,4 +76,5 @@ class GetGroupMemberInfo extends BaseAction { return retMember; } } -export default GetGroupMemberInfo; \ No newline at end of file + +export default GetGroupMemberInfo; diff --git a/src/onebot/action/group/GetGroupMemberList.ts b/src/onebot/action/group/GetGroupMemberList.ts index 3f569f98..10a53d0a 100644 --- a/src/onebot/action/group/GetGroupMemberList.ts +++ b/src/onebot/action/group/GetGroupMemberList.ts @@ -1,16 +1,16 @@ - import { OB11GroupMember } from '../../types'; import { OB11Constructor } from '../../helper/data'; 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'] }, no_cache: { type: ['boolean', 'string'] }, }, - required: ['group_id'] + required: ['group_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -18,6 +18,7 @@ type Payload = FromSchema; class GetGroupMemberList extends BaseAction { actionName = ActionName.GetGroupMemberList; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const NTQQWebApi = this.CoreContext.getApiContext().WebApi; @@ -31,7 +32,9 @@ class GetGroupMemberList extends BaseAction { const groupMembers = await NTQQGroupApi.getGroupMembers(payload.group_id.toString()); const groupMembersArr = Array.from(groupMembers.values()); const groupMembersUids = groupMembersArr.map(e => e.uid); - let _groupMembers = groupMembersArr.map(item => { return OB11Constructor.groupMember(group.groupCode, item); }); + let _groupMembers = groupMembersArr.map(item => { + return OB11Constructor.groupMember(group.groupCode, item); + }); const MemberMap: Map = new Map(); // 转为Map 方便索引 diff --git a/src/onebot/action/group/GetGroupNotice.ts b/src/onebot/action/group/GetGroupNotice.ts index 34a34b76..678ef92e 100644 --- a/src/onebot/action/group/GetGroupNotice.ts +++ b/src/onebot/action/group/GetGroupNotice.ts @@ -2,25 +2,26 @@ import { WebApiGroupNoticeFeed } from '@/core'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + interface GroupNotice { - sender_id: number - publish_time: number - message: { - text: string - image: Array<{ - height: string - width: string - id: string - }> - } + sender_id: number; + publish_time: number; + message: { + text: string + image: Array<{ + height: string + width: string + id: string + }> + }; } const SchemaData = { type: 'object', properties: { - group_id: { type: [ 'number' , 'string' ] }, + group_id: { type: ['number', 'string'] }, }, - required: ['group_id'] + required: ['group_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -30,6 +31,7 @@ type ApiGroupNotice = GroupNotice & WebApiGroupNoticeFeed; export class GetGroupNotice extends BaseAction { actionName = ActionName.GoCQHTTP_GetGroupNotice; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQWebApi = this.CoreContext.getApiContext().WebApi; @@ -49,8 +51,8 @@ export class GetGroupNotice extends BaseAction { text: retApiNotice.msg.text, image: retApiNotice.msg.pics?.map((pic) => { return { id: pic.id, height: pic.h, width: pic.w }; - }) || [] - } + }) || [], + }, }; retNotices.push(retNotice); } diff --git a/src/onebot/action/group/GetGroupSystemMsg.ts b/src/onebot/action/group/GetGroupSystemMsg.ts index eb57f66a..03e7291d 100644 --- a/src/onebot/action/group/GetGroupSystemMsg.ts +++ b/src/onebot/action/group/GetGroupSystemMsg.ts @@ -5,7 +5,7 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { type: 'object', properties: { - group_id: { type: ['number', 'string'] } + group_id: { type: ['number', 'string'] }, }, } as const satisfies JSONSchema; @@ -13,6 +13,7 @@ type Payload = FromSchema; export class GetGroupSystemMsg extends BaseAction { actionName = ActionName.GetGroupSystemMsg; + protected async _handle(payload: void) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; diff --git a/src/onebot/action/group/SetEssenceMsg.ts b/src/onebot/action/group/SetEssenceMsg.ts index 02a3d70c..c7c53ea5 100644 --- a/src/onebot/action/group/SetEssenceMsg.ts +++ b/src/onebot/action/group/SetEssenceMsg.ts @@ -6,9 +6,9 @@ import { MessageUnique } from '@/common/utils/MessageUnique'; const SchemaData = { type: 'object', properties: { - message_id: { type: ['number', 'string'] } + message_id: { type: ['number', 'string'] }, }, - required: ['message_id'] + required: ['message_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -16,6 +16,7 @@ type Payload = FromSchema; export default class SetEssenceMsg extends BaseAction { actionName = ActionName.SetEssenceMsg; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const msg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); @@ -24,7 +25,7 @@ export default class SetEssenceMsg extends BaseAction { } return await NTQQGroupApi.addGroupEssence( msg.Peer.peerUid, - msg.MsgId + msg.MsgId, ); } } diff --git a/src/onebot/action/group/SetGroupAddRequest.ts b/src/onebot/action/group/SetGroupAddRequest.ts index 3c67a164..4934474a 100644 --- a/src/onebot/action/group/SetGroupAddRequest.ts +++ b/src/onebot/action/group/SetGroupAddRequest.ts @@ -1,7 +1,6 @@ import BaseAction from '../BaseAction'; import { GroupRequestOperateTypes } from '@/core/entities'; import { ActionName } from '../types'; -import { NTQQGroupApi } from '@/core/apis/group'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { @@ -9,7 +8,7 @@ const SchemaData = { properties: { flag: { type: 'string' }, approve: { type: ['string', 'boolean'] }, - reason: { type: 'string', nullable: true, } + reason: { type: 'string', nullable: true }, }, required: ['flag'], } as const satisfies JSONSchema; @@ -19,13 +18,14 @@ type Payload = FromSchema; export default class SetGroupAddRequest extends BaseAction { actionName = ActionName.SetGroupAddRequest; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const flag = payload.flag.toString(); const approve = payload.approve?.toString() !== 'false'; await NTQQGroupApi.handleGroupRequest(flag, approve ? GroupRequestOperateTypes.approve : GroupRequestOperateTypes.reject, - payload.reason || " " + payload.reason || ' ', ); return null; } diff --git a/src/onebot/action/group/SetGroupAdmin.ts b/src/onebot/action/group/SetGroupAdmin.ts index 8a4fe067..1daf1fe1 100644 --- a/src/onebot/action/group/SetGroupAdmin.ts +++ b/src/onebot/action/group/SetGroupAdmin.ts @@ -1,17 +1,16 @@ import BaseAction from '../BaseAction'; import { GroupMemberRole } from '@/core/entities'; import { ActionName } from '../types'; -import { NTQQGroupApi } from '@/core/apis/group'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { type: 'object', properties: { - group_id: { type: [ 'number' , 'string' ] }, - user_id: { type: [ 'number' , 'string' ] }, - enable: { type: 'boolean' } + group_id: { type: ['number', 'string'] }, + user_id: { type: ['number', 'string'] }, + enable: { type: 'boolean' }, }, - required: ['group_id', 'user_id'] + required: ['group_id', 'user_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -19,11 +18,12 @@ type Payload = FromSchema; export default class SetGroupAdmin extends BaseAction { actionName = ActionName.SetGroupAdmin; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const uid = await NTQQUserApi.getUidByUin(payload.user_id.toString()); - if(!uid) throw new Error('get Uid Error'); + if (!uid) throw new Error('get Uid Error'); await NTQQGroupApi.setMemberRole(payload.group_id.toString(), uid, payload.enable ? GroupMemberRole.admin : GroupMemberRole.normal); return null; } diff --git a/src/onebot/action/group/SetGroupBan.ts b/src/onebot/action/group/SetGroupBan.ts index e2087336..7408a8ea 100644 --- a/src/onebot/action/group/SetGroupBan.ts +++ b/src/onebot/action/group/SetGroupBan.ts @@ -7,9 +7,9 @@ const SchemaData = { properties: { group_id: { type: ['number', 'string'] }, user_id: { type: ['number', 'string'] }, - duration: { type: ['number', 'string'] } + duration: { type: ['number', 'string'] }, }, - required: ['group_id', 'user_id', 'duration'] + required: ['group_id', 'user_id', 'duration'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -17,11 +17,12 @@ type Payload = FromSchema; export default class SetGroupBan extends BaseAction { actionName = ActionName.SetGroupBan; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const uid = await NTQQUserApi.getUidByUin(payload.user_id.toString()); - if(!uid) throw new Error('uid error'); + if (!uid) throw new Error('uid error'); await NTQQGroupApi.banMember(payload.group_id.toString(), [{ uid: uid, timeStamp: parseInt(payload.duration.toString()) }]); return null; diff --git a/src/onebot/action/group/SetGroupCard.ts b/src/onebot/action/group/SetGroupCard.ts index 3fe91b2d..5a73bb2b 100644 --- a/src/onebot/action/group/SetGroupCard.ts +++ b/src/onebot/action/group/SetGroupCard.ts @@ -5,11 +5,11 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { type: 'object', properties: { - group_id: { type: [ 'number' , 'string' ] }, - user_id: { type: [ 'number' , 'string' ] }, - card: { type: 'string' } + group_id: { type: ['number', 'string'] }, + user_id: { type: ['number', 'string'] }, + card: { type: 'string' }, }, - required: ['group_id', 'user_id', 'card'] + required: ['group_id', 'user_id', 'card'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -17,6 +17,7 @@ type Payload = FromSchema; export default class SetGroupCard extends BaseAction { actionName = ActionName.SetGroupCard; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; await NTQQGroupApi.setMemberCard(payload.group_id.toString(), member.uid, payload.card || ''); diff --git a/src/onebot/action/group/SetGroupKick.ts b/src/onebot/action/group/SetGroupKick.ts index 143b379f..782a386f 100644 --- a/src/onebot/action/group/SetGroupKick.ts +++ b/src/onebot/action/group/SetGroupKick.ts @@ -1,17 +1,16 @@ import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQGroupApi } from '@/core/apis/group'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { type: 'object', properties: { - group_id: { type: [ 'number' , 'string' ] }, - user_id: { type: [ 'number' , 'string' ] }, - reject_add_request: { type: [ 'boolean' , 'string' ] } + group_id: { type: ['number', 'string'] }, + user_id: { type: ['number', 'string'] }, + reject_add_request: { type: ['boolean', 'string'] }, }, - required: ['group_id', 'user_id'] + required: ['group_id', 'user_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -19,12 +18,13 @@ type Payload = FromSchema; export default class SetGroupKick extends BaseAction { actionName = ActionName.SetGroupKick; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const rejectReq = payload.reject_add_request?.toString() == 'true'; const uid = await NTQQUserApi.getUidByUin(payload.user_id.toString()); - if(!uid) throw new Error('get Uid Error'); + if (!uid) throw new Error('get Uid Error'); await NTQQGroupApi.kickMember(payload.group_id.toString(), [uid], rejectReq); return null; } diff --git a/src/onebot/action/group/SetGroupLeave.ts b/src/onebot/action/group/SetGroupLeave.ts index 3874c50b..8ec8a495 100644 --- a/src/onebot/action/group/SetGroupLeave.ts +++ b/src/onebot/action/group/SetGroupLeave.ts @@ -1,19 +1,21 @@ 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' ] }, - is_dismiss: { type: 'boolean' } + group_id: { type: ['number', 'string'] }, + is_dismiss: { type: 'boolean' }, }, - required: ['group_id'] + required: ['group_id'], } as const satisfies JSONSchema; type Payload = FromSchema; export default class SetGroupLeave extends BaseAction { actionName = ActionName.SetGroupLeave; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; await NTQQGroupApi.quitGroup(payload.group_id.toString()); diff --git a/src/onebot/action/group/SetGroupName.ts b/src/onebot/action/group/SetGroupName.ts index 4c63581d..1c1ed3a6 100644 --- a/src/onebot/action/group/SetGroupName.ts +++ b/src/onebot/action/group/SetGroupName.ts @@ -1,21 +1,21 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQGroupApi } from '@/core/apis/group'; const SchemaData = { type: 'object', properties: { - group_id: { type: [ 'number' , 'string' ] }, - group_name: { type: 'string' } + group_id: { type: ['number', 'string'] }, + group_name: { type: 'string' }, }, - required: ['group_id', 'group_name'] + required: ['group_id', 'group_name'], } as const satisfies JSONSchema; type Payload = FromSchema; export default class SetGroupName extends BaseAction { actionName = ActionName.SetGroupName; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; await NTQQGroupApi.setGroupName(payload.group_id.toString(), payload.group_name); diff --git a/src/onebot/action/group/SetGroupWholeBan.ts b/src/onebot/action/group/SetGroupWholeBan.ts index 08ba465c..6f62983d 100644 --- a/src/onebot/action/group/SetGroupWholeBan.ts +++ b/src/onebot/action/group/SetGroupWholeBan.ts @@ -1,13 +1,14 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; + const SchemaData = { type: 'object', properties: { - group_id: { type: [ 'number' , 'string' ] }, - enable: { type: ['boolean','string'] } + group_id: { type: ['number', 'string'] }, + enable: { type: ['boolean', 'string'] }, }, - required: ['group_id'] + required: ['group_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -15,6 +16,7 @@ type Payload = FromSchema; export default class SetGroupWholeBan extends BaseAction { actionName = ActionName.SetGroupWholeBan; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const enable = payload.enable?.toString() !== 'false'; const NTQQGroupApi = this.CoreContext.getApiContext().GroupApi; diff --git a/src/onebot/action/index.ts b/src/onebot/action/index.ts index aeba84ef..263e9c4a 100644 --- a/src/onebot/action/index.ts +++ b/src/onebot/action/index.ts @@ -17,7 +17,7 @@ import GetStatus from './system/GetStatus'; import { GoCQHTTPSendForwardMsg, GoCQHTTPSendGroupForwardMsg, - GoCQHTTPSendPrivateForwardMsg + GoCQHTTPSendPrivateForwardMsg, } from './go-cqhttp/SendForwardMsg'; import GoCQHTTPGetStrangerInfo from './go-cqhttp/GetStrangerInfo'; import SendLike from './user/SendLike'; @@ -78,86 +78,86 @@ import { NapCatOneBot11Adapter } from '../main'; export function createActionMap(onebotContext: NapCatOneBot11Adapter, coreContext: NapCatCore) { const actionHandlers = [ - new FetchEmojiLike(onebotContext,coreContext), - new GetFile(onebotContext,coreContext), - new SetSelfProfile(onebotContext,coreContext), - new shareGroupEx(onebotContext,coreContext), - new sharePeer(onebotContext,coreContext), - new CreateCollection(onebotContext,coreContext), - new SetLongNick(onebotContext,coreContext), - new ForwardFriendSingleMsg(onebotContext,coreContext), - new ForwardGroupSingleMsg(onebotContext,coreContext), - new MarkGroupMsgAsRead(onebotContext,coreContext), - new MarkPrivateMsgAsRead(onebotContext,coreContext), - new SetQQAvatar(onebotContext,coreContext), - new TranslateEnWordToZn(onebotContext,coreContext), - new GetGroupFileCount(onebotContext,coreContext), - new GetGroupFileList(onebotContext,coreContext), - new SetGroupFileFolder(onebotContext,coreContext), - new DelGroupFile(onebotContext,coreContext), - new DelGroupFileFolder(onebotContext,coreContext), + new FetchEmojiLike(onebotContext, coreContext), + new GetFile(onebotContext, coreContext), + new SetSelfProfile(onebotContext, coreContext), + new shareGroupEx(onebotContext, coreContext), + new sharePeer(onebotContext, coreContext), + new CreateCollection(onebotContext, coreContext), + new SetLongNick(onebotContext, coreContext), + new ForwardFriendSingleMsg(onebotContext, coreContext), + new ForwardGroupSingleMsg(onebotContext, coreContext), + new MarkGroupMsgAsRead(onebotContext, coreContext), + new MarkPrivateMsgAsRead(onebotContext, coreContext), + new SetQQAvatar(onebotContext, coreContext), + new TranslateEnWordToZn(onebotContext, coreContext), + new GetGroupFileCount(onebotContext, coreContext), + new GetGroupFileList(onebotContext, coreContext), + new SetGroupFileFolder(onebotContext, coreContext), + new DelGroupFile(onebotContext, coreContext), + new DelGroupFileFolder(onebotContext, coreContext), // onebot11 - new SendLike(onebotContext,coreContext), - new GetMsg(onebotContext,coreContext), - new GetLoginInfo(onebotContext,coreContext), - new GetFriendList(onebotContext,coreContext), - new GetGroupList(onebotContext,coreContext), - new GetGroupInfo(onebotContext,coreContext), - new GetGroupMemberList(onebotContext,coreContext), - new GetGroupMemberInfo(onebotContext,coreContext), - new SendGroupMsg(onebotContext,coreContext), - new SendPrivateMsg(onebotContext,coreContext), - new SendMsg(onebotContext,coreContext), - new DeleteMsg(onebotContext,coreContext), - new SetGroupAddRequest(onebotContext,coreContext), - new SetFriendAddRequest(onebotContext,coreContext), - new SetGroupLeave(onebotContext,coreContext), - new GetVersionInfo(onebotContext,coreContext), - new CanSendRecord(onebotContext,coreContext), - new CanSendImage(onebotContext,coreContext), - new GetStatus(onebotContext,coreContext), - new SetGroupWholeBan(onebotContext,coreContext), - new SetGroupBan(onebotContext,coreContext), - new SetGroupKick(onebotContext,coreContext), - new SetGroupAdmin(onebotContext,coreContext), - new SetGroupName(onebotContext,coreContext), - new SetGroupCard(onebotContext,coreContext), - new GetImage(onebotContext,coreContext), - new GetRecord(onebotContext,coreContext), - new SetMsgEmojiLike(onebotContext,coreContext), - new GetCookies(onebotContext,coreContext), - new SetOnlineStatus(onebotContext,coreContext), - new GetRobotUinRange(onebotContext,coreContext), - new GetFriendWithCategory(onebotContext,coreContext), + new SendLike(onebotContext, coreContext), + new GetMsg(onebotContext, coreContext), + new GetLoginInfo(onebotContext, coreContext), + new GetFriendList(onebotContext, coreContext), + new GetGroupList(onebotContext, coreContext), + new GetGroupInfo(onebotContext, coreContext), + new GetGroupMemberList(onebotContext, coreContext), + new GetGroupMemberInfo(onebotContext, coreContext), + new SendGroupMsg(onebotContext, coreContext), + new SendPrivateMsg(onebotContext, coreContext), + new SendMsg(onebotContext, coreContext), + new DeleteMsg(onebotContext, coreContext), + new SetGroupAddRequest(onebotContext, coreContext), + new SetFriendAddRequest(onebotContext, coreContext), + new SetGroupLeave(onebotContext, coreContext), + new GetVersionInfo(onebotContext, coreContext), + new CanSendRecord(onebotContext, coreContext), + new CanSendImage(onebotContext, coreContext), + new GetStatus(onebotContext, coreContext), + new SetGroupWholeBan(onebotContext, coreContext), + new SetGroupBan(onebotContext, coreContext), + new SetGroupKick(onebotContext, coreContext), + new SetGroupAdmin(onebotContext, coreContext), + new SetGroupName(onebotContext, coreContext), + new SetGroupCard(onebotContext, coreContext), + new GetImage(onebotContext, coreContext), + new GetRecord(onebotContext, coreContext), + new SetMsgEmojiLike(onebotContext, coreContext), + new GetCookies(onebotContext, coreContext), + new SetOnlineStatus(onebotContext, coreContext), + new GetRobotUinRange(onebotContext, coreContext), + new GetFriendWithCategory(onebotContext, coreContext), //以下为go-cqhttp api - new GetOnlineClient(onebotContext,coreContext), - new OCRImage(onebotContext,coreContext), - new IOCRImage(onebotContext,coreContext), - new GetGroupHonorInfo(onebotContext,coreContext), - new SendGroupNotice(onebotContext,coreContext), - new GetGroupNotice(onebotContext,coreContext), - new GetGroupEssence(onebotContext,coreContext), - new GoCQHTTPSendForwardMsg(onebotContext,coreContext), - new GoCQHTTPSendGroupForwardMsg(onebotContext,coreContext), - new GoCQHTTPSendPrivateForwardMsg(onebotContext,coreContext), - new GoCQHTTPGetStrangerInfo(onebotContext,coreContext), - new GoCQHTTPDownloadFile(onebotContext,coreContext), - new GetGuildList(onebotContext,coreContext), - new GoCQHTTPMarkMsgAsRead(onebotContext,coreContext), - new GoCQHTTPUploadGroupFile(onebotContext,coreContext), - new GoCQHTTPGetGroupMsgHistory(onebotContext,coreContext), - new GoCQHTTPGetForwardMsgAction(onebotContext,coreContext), - new GetFriendMsgHistory(onebotContext,coreContext), - new GoCQHTTPHandleQuickAction(onebotContext,coreContext), - new GetGroupSystemMsg(onebotContext,coreContext), - new DelEssenceMsg(onebotContext,coreContext), - new SetEssenceMsg(onebotContext,coreContext), - new GetRecentContact(onebotContext,coreContext), - new MarkAllMsgAsRead(onebotContext,coreContext), - new GetProfileLike(onebotContext,coreContext), - new SetGroupHeader(onebotContext,coreContext), - new FetchCustomFace(onebotContext,coreContext), - new GoCQHTTPUploadPrivateFile(onebotContext,coreContext) + new GetOnlineClient(onebotContext, coreContext), + new OCRImage(onebotContext, coreContext), + new IOCRImage(onebotContext, coreContext), + new GetGroupHonorInfo(onebotContext, coreContext), + new SendGroupNotice(onebotContext, coreContext), + new GetGroupNotice(onebotContext, coreContext), + new GetGroupEssence(onebotContext, coreContext), + new GoCQHTTPSendForwardMsg(onebotContext, coreContext), + new GoCQHTTPSendGroupForwardMsg(onebotContext, coreContext), + new GoCQHTTPSendPrivateForwardMsg(onebotContext, coreContext), + new GoCQHTTPGetStrangerInfo(onebotContext, coreContext), + new GoCQHTTPDownloadFile(onebotContext, coreContext), + new GetGuildList(onebotContext, coreContext), + new GoCQHTTPMarkMsgAsRead(onebotContext, coreContext), + new GoCQHTTPUploadGroupFile(onebotContext, coreContext), + new GoCQHTTPGetGroupMsgHistory(onebotContext, coreContext), + new GoCQHTTPGetForwardMsgAction(onebotContext, coreContext), + new GetFriendMsgHistory(onebotContext, coreContext), + new GoCQHTTPHandleQuickAction(onebotContext, coreContext), + new GetGroupSystemMsg(onebotContext, coreContext), + new DelEssenceMsg(onebotContext, coreContext), + new SetEssenceMsg(onebotContext, coreContext), + new GetRecentContact(onebotContext, coreContext), + new MarkAllMsgAsRead(onebotContext, coreContext), + new GetProfileLike(onebotContext, coreContext), + new SetGroupHeader(onebotContext, coreContext), + new FetchCustomFace(onebotContext, coreContext), + new GoCQHTTPUploadPrivateFile(onebotContext, coreContext), ]; const actionMap = new Map>(); for (const action of actionHandlers) { diff --git a/src/onebot/action/msg/DeleteMsg.ts b/src/onebot/action/msg/DeleteMsg.ts index a666e6b1..16b6368c 100644 --- a/src/onebot/action/msg/DeleteMsg.ts +++ b/src/onebot/action/msg/DeleteMsg.ts @@ -10,11 +10,11 @@ const SchemaData = { message_id: { oneOf: [ { type: 'number' }, - { type: 'string' } - ] - } + { type: 'string' }, + ], + }, }, - required: ['message_id'] + required: ['message_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -22,6 +22,7 @@ type Payload = FromSchema; class DeleteMsg extends BaseAction { actionName = ActionName.DeleteMsg; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const msg = MessageUnique.getMsgIdAndPeerByShortId(Number(payload.message_id)); @@ -36,8 +37,10 @@ class DeleteMsg extends BaseAction { return true; } return false; - } - ).catch(e => new Promise((resolve, reject) => { resolve(undefined); })); + }, + ).catch(e => new Promise((resolve, reject) => { + resolve(undefined); + })); await NTQQMsgApi.recallMsg(msg.Peer, [msg.MsgId]); const data = await ret; if (!data) { diff --git a/src/onebot/action/msg/ForwardSingleMsg.ts b/src/onebot/action/msg/ForwardSingleMsg.ts index 31f55ddf..273f0295 100644 --- a/src/onebot/action/msg/ForwardSingleMsg.ts +++ b/src/onebot/action/msg/ForwardSingleMsg.ts @@ -9,9 +9,9 @@ const SchemaData = { properties: { message_id: { type: 'number' }, group_id: { type: ['number', 'string'] }, - user_id: { type: ['number', 'string'] } + user_id: { type: ['number', 'string'] }, }, - required: ['message_id'] + required: ['message_id'], } as const satisfies JSONSchema; type Payload = FromSchema; diff --git a/src/onebot/action/msg/GetMsg.ts b/src/onebot/action/msg/GetMsg.ts index b2b53023..2841035a 100644 --- a/src/onebot/action/msg/GetMsg.ts +++ b/src/onebot/action/msg/GetMsg.ts @@ -13,7 +13,7 @@ const SchemaData = { properties: { message_id: { type: ['number', 'string'] }, }, - required: ['message_id'] + required: ['message_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -21,6 +21,7 @@ type Payload = FromSchema; class GetMsg extends BaseAction { actionName = ActionName.GetMsg; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; // log("history msg ids", Object.keys(msgHistory)); @@ -36,7 +37,7 @@ class GetMsg extends BaseAction { const msg = await NTQQMsgApi.getMsgsByMsgId( peer, [msgIdWithPeer?.MsgId || payload.message_id.toString()]); - const retMsg = await OB11Constructor.message(this.CoreContext, msg.msgList[0], "array"); + const retMsg = await OB11Constructor.message(this.CoreContext, msg.msgList[0], 'array'); try { retMsg.message_id = MessageUnique.createMsg(peer, msg.msgList[0].msgId)!; retMsg.message_seq = retMsg.message_id; diff --git a/src/onebot/action/msg/MarkMsgAsRead.ts b/src/onebot/action/msg/MarkMsgAsRead.ts index c55987bd..953c5db5 100644 --- a/src/onebot/action/msg/MarkMsgAsRead.ts +++ b/src/onebot/action/msg/MarkMsgAsRead.ts @@ -1,15 +1,14 @@ import { ChatType, Peer } from '@/core/entities'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQFriendApi, NTQQMsgApi, NTQQUserApi } from '@/core/apis'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; const SchemaData = { type: 'object', properties: { user_id: { type: ['number', 'string'] }, - group_id: { type: ['number', 'string'] } - } + group_id: { type: ['number', 'string'] }, + }, } as const satisfies JSONSchema; type PlayloadType = FromSchema; @@ -31,6 +30,7 @@ class MarkMsgAsRead extends BaseAction { } return { chatType: ChatType.group, peerUid: payload.group_id.toString() }; } + protected async _handle(payload: PlayloadType): Promise { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; // 调用API @@ -41,11 +41,13 @@ class MarkMsgAsRead extends BaseAction { return null; } } + // 以下为非标准实现 export class MarkPrivateMsgAsRead extends MarkMsgAsRead { PayloadSchema = SchemaData; actionName = ActionName.MarkPrivateMsgAsRead; } + export class MarkGroupMsgAsRead extends MarkMsgAsRead { PayloadSchema = SchemaData; actionName = ActionName.MarkGroupMsgAsRead; @@ -53,7 +55,7 @@ export class MarkGroupMsgAsRead extends MarkMsgAsRead { interface Payload { - message_id: number + message_id: number; } export class GoCQHTTPMarkMsgAsRead extends BaseAction { diff --git a/src/onebot/action/msg/SendMsg/create-send-elements.ts b/src/onebot/action/msg/SendMsg/create-send-elements.ts index 09082dab..4efeeef7 100644 --- a/src/onebot/action/msg/SendMsg/create-send-elements.ts +++ b/src/onebot/action/msg/SendMsg/create-send-elements.ts @@ -6,16 +6,23 @@ import { AtType, CustomMusicSignPostData, IdMusicSignPostData, NapCatCore, Peer, import { SendMsgElementConstructor } from '@/onebot/helper/msg'; export type MessageContext = { - deleteAfterSentFiles: string[], - peer: Peer + deleteAfterSentFiles: string[], + peer: Peer } + async function handleOb11FileLikeMessage( coreContext: NapCatCore, { data: inputdata }: OB11MessageFileBase, - { deleteAfterSentFiles }: MessageContext + { deleteAfterSentFiles }: MessageContext, ) { //有的奇怪的框架将url作为参数 而不是file 此时优先url 同时注意可能传入的是非file://开头的目录 By Mlikiowa - const { path, isLocal, fileName, errMsg, success } = (await uri2local(coreContext.NapCatTempPath, inputdata?.url || inputdata.file)); + const { + path, + isLocal, + fileName, + errMsg, + success, + } = (await uri2local(coreContext.NapCatTempPath, inputdata?.url || inputdata.file)); if (!success) { coreContext.context.logger.logError('文件下载失败', errMsg); @@ -30,13 +37,13 @@ async function handleOb11FileLikeMessage( } const _handlers: { - [Key in OB11MessageDataType]: ( - CoreContext: NapCatCore, - sendMsg: Extract, - // This picks the correct message type out - // How great the type system of TypeScript is! - context: MessageContext - ) => Promise + [Key in OB11MessageDataType]: ( + CoreContext: NapCatCore, + sendMsg: Extract, + // This picks the correct message type out + // How great the type system of TypeScript is! + context: MessageContext, + ) => Promise } = { [OB11MessageDataType.text]: async (coreContext, { data: { text } }) => SendMsgElementConstructor.text(coreContext, text), @@ -49,7 +56,7 @@ const _handlers: { // Mlikiowa V2.0.0 Refactor Todo const uid = await coreContext.getApiContext().UserApi.getUidByUin(atQQ); if (!uid) throw new Error('Get Uid Error'); - return SendMsgElementConstructor.at(coreContext, atQQ, uid, AtType.atUser, ""); + return SendMsgElementConstructor.at(coreContext, atQQ, uid, AtType.atUser, ''); }, [OB11MessageDataType.reply]: async (coreContext, { data: { id } }) => { const replyMsgM = MessageUnique.getMsgIdAndPeerByShortId(parseInt(id)); @@ -69,8 +76,8 @@ const _handlers: { [OB11MessageDataType.mface]: async (coreContext, { data: { - emoji_package_id, emoji_id, key, summary - } + emoji_package_id, emoji_id, key, summary, + }, }) => SendMsgElementConstructor.mface(coreContext, emoji_package_id, emoji_id, key, summary), // File service @@ -79,7 +86,7 @@ const _handlers: { coreContext, (await handleOb11FileLikeMessage(coreContext, sendMsg, context)).path, sendMsg.data.summary || '', - sendMsg.data.subType || 0 + sendMsg.data.subType || 0, ); context.deleteAfterSentFiles.push(PicEle.picElement.sourcePath); return PicEle; @@ -119,7 +126,7 @@ const _handlers: { [OB11MessageDataType.markdown]: async (coreContext, { data: { content } }) => SendMsgElementConstructor.markdown(coreContext, content), [OB11MessageDataType.music]: async (coreContext, { data }) => { - // 保留, 直到...找到更好的解决方案 + // 保留, 直到...找到更好的解决方案 if (data.type === 'custom') { if (!data.url) { coreContext.context.logger.logError('自定义音卡缺少参数url'); @@ -152,7 +159,7 @@ const _handlers: { postData = data; } // Mlikiowa V2.0.0 Refactor Todo - const signUrl = ""; + const signUrl = ''; if (!signUrl) { if (data.type === 'qq') { //const musicJson = (await SignMusicWrapper(data.id.toString())).data.arkResult.slice(0, -1); @@ -179,24 +186,24 @@ const _handlers: { [OB11MessageDataType.Location]: async (coreContext) => { return SendMsgElementConstructor.location(coreContext); }, - [OB11MessageDataType.miniapp]: function (CoreContext: NapCatCore, sendMsg: never, context: MessageContext): Promise { + [OB11MessageDataType.miniapp]: function(CoreContext: NapCatCore, sendMsg: never, context: MessageContext): Promise { throw new Error('Function not implemented.'); - } + }, }; const handlers = <{ - [Key in OB11MessageDataType]: ( - coreContext: NapCatCore, - sendMsg: OB11MessageData, - context: MessageContext - ) => Promise + [Key in OB11MessageDataType]: ( + coreContext: NapCatCore, + sendMsg: OB11MessageData, + context: MessageContext, + ) => Promise }>_handlers; export default async function createSendElements( CoreContext: NapCatCore, messageData: OB11MessageData[], peer: Peer, - ignoreTypes: OB11MessageDataType[] = [] + ignoreTypes: OB11MessageDataType[] = [], ) { const deleteAfterSentFiles: string[] = []; const callResultList: Array> = []; @@ -207,7 +214,7 @@ export default async function createSendElements( const callResult = handlers[sendMsg.type]( CoreContext, sendMsg, - { peer, deleteAfterSentFiles } + { peer, deleteAfterSentFiles }, )?.catch(undefined); callResultList.push(callResult); } @@ -220,19 +227,19 @@ export async function createSendElementsParallel( CoreContext: NapCatCore, messageData: OB11MessageData[], peer: Peer, - ignoreTypes: OB11MessageDataType[] = [] + ignoreTypes: OB11MessageDataType[] = [], ) { const deleteAfterSentFiles: string[] = []; const sendElements = ( - await Promise.all( - messageData.map(async sendMsg => ignoreTypes.includes(sendMsg.type) ? - undefined : - handlers[sendMsg.type](CoreContext, sendMsg, { peer, deleteAfterSentFiles })) - ).then( - results => results.filter( - element => element !== undefined + await Promise.all( + messageData.map(async sendMsg => ignoreTypes.includes(sendMsg.type) ? + undefined : + handlers[sendMsg.type](CoreContext, sendMsg, { peer, deleteAfterSentFiles })), + ).then( + results => results.filter( + element => element !== undefined, + ), ) - ) - ); + ); return { sendElements, deleteAfterSentFiles }; } diff --git a/src/onebot/action/msg/SendMsg/handle-forward-node.ts b/src/onebot/action/msg/SendMsg/handle-forward-node.ts index 014f54fa..f16c88e8 100644 --- a/src/onebot/action/msg/SendMsg/handle-forward-node.ts +++ b/src/onebot/action/msg/SendMsg/handle-forward-node.ts @@ -2,11 +2,12 @@ import { ChatType, ElementType, NapCatCore, Peer, RawMessage, SendMessageElement import { MessageUnique } from '@/common/utils/MessageUnique'; import { OB11MessageDataType, OB11MessageNode } from '@/onebot/types'; import createSendElements from './create-send-elements'; -import { normalize, sendMsg } from "../SendMsg/index"; +import { normalize, sendMsg } from '../SendMsg/index'; + async function cloneMsg(coreContext: NapCatCore, msg: RawMessage): Promise { const selfPeer = { chatType: ChatType.friend, - peerUid: coreContext.selfInfo.uid + peerUid: coreContext.selfInfo.uid, }; const logger = coreContext.context.logger; const NTQQMsgApi = coreContext.getApiContext().MsgApi; @@ -33,7 +34,7 @@ export async function handleForwardNode(coreContext: NapCatCore, destPeer: Peer, const NTQQMsgApi = coreContext.getApiContext().MsgApi; const selfPeer = { chatType: ChatType.friend, - peerUid: coreContext.selfInfo.uid + peerUid: coreContext.selfInfo.uid, }; let nodeMsgIds: string[] = []; const logger = coreContext.context.logger; @@ -54,20 +55,28 @@ export async function handleForwardNode(coreContext: NapCatCore, destPeer: Peer, //筛选node消息 const isNodeMsg = OB11Data.filter(e => e.type === OB11MessageDataType.node).length;//找到子转发消息 if (isNodeMsg !== 0) { - if (isNodeMsg !== OB11Data.length) { logger.logError('子消息中包含非node消息 跳过不合法部分'); continue; } + if (isNodeMsg !== OB11Data.length) { + logger.logError('子消息中包含非node消息 跳过不合法部分'); + continue; + } const nodeMsg = await handleForwardNode(coreContext, selfPeer, OB11Data.filter(e => e.type === OB11MessageDataType.node)); - if (nodeMsg) { nodeMsgIds.push(nodeMsg.msgId); MessageUnique.createMsg(selfPeer, nodeMsg.msgId); } + if (nodeMsg) { + nodeMsgIds.push(nodeMsg.msgId); + MessageUnique.createMsg(selfPeer, nodeMsg.msgId); + } //完成子卡片生成跳过后续 continue; } - const { sendElements } = await createSendElements(coreContext,OB11Data, destPeer); + const { sendElements } = await createSendElements(coreContext, OB11Data, destPeer); //拆分消息 const MixElement = sendElements.filter(element => element.elementType !== ElementType.FILE && element.elementType !== ElementType.VIDEO); const SingleElement = sendElements.filter(element => element.elementType === ElementType.FILE || element.elementType === ElementType.VIDEO).map(e => [e]); const AllElement: SendMessageElement[][] = [MixElement, ...SingleElement].filter(e => e !== undefined && e.length !== 0); const MsgNodeList: Promise[] = []; for (const sendElementsSplitElement of AllElement) { - MsgNodeList.push(sendMsg(coreContext,selfPeer, sendElementsSplitElement, [], true).catch(e => new Promise((resolve, reject) => { resolve(undefined); }))); + MsgNodeList.push(sendMsg(coreContext, selfPeer, sendElementsSplitElement, [], true).catch(e => new Promise((resolve, reject) => { + resolve(undefined); + }))); } (await Promise.allSettled(MsgNodeList)).map((result) => { if (result.status === 'fulfilled' && result.value) { diff --git a/src/onebot/action/msg/SendMsg/index.ts b/src/onebot/action/msg/SendMsg/index.ts index e41765ae..d595affd 100644 --- a/src/onebot/action/msg/SendMsg/index.ts +++ b/src/onebot/action/msg/SendMsg/index.ts @@ -1,10 +1,9 @@ - import { OB11MessageData, OB11MessageDataType, OB11MessageMixType, OB11MessageNode, - OB11PostSendMsg + OB11PostSendMsg, } from '@/onebot/types'; import { ActionName, BaseCheckResult } from '@/onebot/action/types'; import fs from 'node:fs'; @@ -17,13 +16,15 @@ import BaseAction from '../../BaseAction'; import { handleForwardNode } from './handle-forward-node'; export interface ReturnDataType { - message_id: number; + message_id: number; } + export enum ContextMode { - Normal = 0, - Private = 1, - Group = 2 + Normal = 0, + Private = 1, + Group = 2 } + // Normalizes a mixed type (CQCode/a single segment/segment array) into a segment array. export function normalize(message: OB11MessageMixType, autoEscape = false): OB11MessageData[] { return typeof message === 'string' ? ( @@ -68,12 +69,18 @@ export async function sendMsg(coreContext: NapCatCore, peer: Peer, sendElements: } const returnMsg = await NTQQMsgApi.sendMsg(peer, sendElements, waitComplete, timeout); try { - returnMsg!.id = MessageUnique.createMsg({ chatType: peer.chatType, guildId: '', peerUid: peer.peerUid }, returnMsg!.msgId); + returnMsg!.id = MessageUnique.createMsg({ + chatType: peer.chatType, + guildId: '', + peerUid: peer.peerUid, + }, returnMsg!.msgId); } catch (e: any) { logger.logDebug('发送消息id获取失败', e); - returnMsg!.id = 0; + returnMsg!.id = 0; } - deleteAfterSentFiles.map((f) => { fsPromise.unlink(f).then().catch(e => logger.logError('发送消息删除文件失败', e)); }); + deleteAfterSentFiles.map((f) => { + fsPromise.unlink(f).then().catch(e => logger.logError('发送消息删除文件失败', e)); + }); return returnMsg; } @@ -88,7 +95,7 @@ async function createContext(coreContext: NapCatCore, payload: OB11PostSendMsg, const group = (await NTQQGroupApi.getGroups()).find(e => e.groupCode == payload.group_id?.toString()); return { chatType: ChatType.group, - peerUid: payload.group_id.toString() + peerUid: payload.group_id.toString(), }; } if ((contextMode === ContextMode.Private || contextMode === ContextMode.Normal) && payload.user_id) { @@ -97,7 +104,7 @@ async function createContext(coreContext: NapCatCore, payload: OB11PostSendMsg, //console.log("[调试代码] UIN:", payload.user_id, " UID:", Uid, " IsBuddy:", isBuddy); return { chatType: isBuddy ? ChatType.friend : ChatType.temp, - peerUid: Uid! + peerUid: Uid!, }; } throw '请指定 group_id 或 user_id'; @@ -121,7 +128,10 @@ export class SendMsg extends BaseAction { const messages = normalize(payload.message); const nodeElementLength = getSpecialMsgNum(payload, OB11MessageDataType.node); if (nodeElementLength > 0 && nodeElementLength != messages.length) { - return { valid: false, message: '转发消息不能和普通消息混在一起发送,转发需要保证message只有type为node的元素' }; + return { + valid: false, + message: '转发消息不能和普通消息混在一起发送,转发需要保证message只有type为node的元素', + }; } // if (payload.message_type !== 'private' && payload.group_id && !(await getGroup(payload.group_id))) { // return { valid: false, message: `群${payload.group_id}不存在` }; @@ -142,13 +152,17 @@ export class SendMsg extends BaseAction { const messages = normalize( payload.message, - payload.auto_escape === true || payload.auto_escape === 'true' + payload.auto_escape === true || payload.auto_escape === 'true', ); if (getSpecialMsgNum(payload, OB11MessageDataType.node)) { - const returnMsg = await handleForwardNode(this.CoreContext,peer, messages as OB11MessageNode[]); + const returnMsg = await handleForwardNode(this.CoreContext, peer, messages as OB11MessageNode[]); if (returnMsg) { - const msgShortId = MessageUnique.createMsg({ guildId: '', peerUid: peer.peerUid, chatType: peer.chatType }, returnMsg!.msgId); + const msgShortId = MessageUnique.createMsg({ + guildId: '', + peerUid: peer.peerUid, + chatType: peer.chatType, + }, returnMsg!.msgId); return { message_id: msgShortId! }; } else { throw Error('发送转发消息失败'); diff --git a/src/onebot/action/msg/SendPrivateMsg.ts b/src/onebot/action/msg/SendPrivateMsg.ts index 25af0f9a..b21005d5 100644 --- a/src/onebot/action/msg/SendPrivateMsg.ts +++ b/src/onebot/action/msg/SendPrivateMsg.ts @@ -1,6 +1,7 @@ import SendMsg, { ContextMode } from './SendMsg'; import { ActionName, BaseCheckResult } from '../types'; import { OB11PostSendMsg } from '../../types'; + // 未检测参数 class SendPrivateMsg extends SendMsg { actionName = ActionName.SendPrivateMsg; diff --git a/src/onebot/action/msg/SetMsgEmojiLike.ts b/src/onebot/action/msg/SetMsgEmojiLike.ts index 85bc9f54..de2fa341 100644 --- a/src/onebot/action/msg/SetMsgEmojiLike.ts +++ b/src/onebot/action/msg/SetMsgEmojiLike.ts @@ -1,6 +1,5 @@ import { ActionName } from '../types'; import BaseAction from '../BaseAction'; -import { NTQQMsgApi } from '@/core/apis'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { MessageUnique } from '@/common/utils/MessageUnique'; @@ -8,9 +7,9 @@ const SchemaData = { type: 'object', properties: { message_id: { type: ['string', 'number'] }, - emoji_id: { type: ['string', 'number'] } + emoji_id: { type: ['string', 'number'] }, }, - required: ['message_id', 'emoji_id'] + required: ['message_id', 'emoji_id'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -18,6 +17,7 @@ type Payload = FromSchema; export class SetMsgEmojiLike extends BaseAction { actionName = ActionName.SetMsgEmojiLike; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; const msg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(payload.message_id.toString())); diff --git a/src/onebot/action/system/CanSendImage.ts b/src/onebot/action/system/CanSendImage.ts index c89559a7..ab6a4d7b 100644 --- a/src/onebot/action/system/CanSendImage.ts +++ b/src/onebot/action/system/CanSendImage.ts @@ -2,7 +2,7 @@ import { ActionName } from '../types'; import CanSendRecord from './CanSendRecord'; interface ReturnType { - yes: boolean + yes: boolean; } export default class CanSendImage extends CanSendRecord { diff --git a/src/onebot/action/system/CanSendRecord.ts b/src/onebot/action/system/CanSendRecord.ts index 4d2f6a5c..6d52b638 100644 --- a/src/onebot/action/system/CanSendRecord.ts +++ b/src/onebot/action/system/CanSendRecord.ts @@ -2,7 +2,7 @@ import BaseAction from '../BaseAction'; import { ActionName } from '../types'; interface ReturnType { - yes: boolean + yes: boolean; } export default class CanSendRecord extends BaseAction { @@ -10,7 +10,7 @@ export default class CanSendRecord extends BaseAction { protected async _handle(_payload: void): Promise { return { - yes: true + yes: true, }; } } diff --git a/src/onebot/action/system/GetLoginInfo.ts b/src/onebot/action/system/GetLoginInfo.ts index e123e77b..17500f8f 100644 --- a/src/onebot/action/system/GetLoginInfo.ts +++ b/src/onebot/action/system/GetLoginInfo.ts @@ -1,4 +1,3 @@ - import { OB11User } from '../../types'; import { OB11Constructor } from '../../helper/data'; import BaseAction from '../BaseAction'; diff --git a/src/onebot/action/system/GetStatus.ts b/src/onebot/action/system/GetStatus.ts index 7121afab..30d2ed2f 100644 --- a/src/onebot/action/system/GetStatus.ts +++ b/src/onebot/action/system/GetStatus.ts @@ -8,7 +8,7 @@ export default class GetStatus extends BaseAction { return { online: !!this.CoreContext.selfInfo.online, good: true, - stat:{} + stat: {}, }; } } diff --git a/src/onebot/action/system/GetVersionInfo.ts b/src/onebot/action/system/GetVersionInfo.ts index 9b7a4217..4e20a6a8 100644 --- a/src/onebot/action/system/GetVersionInfo.ts +++ b/src/onebot/action/system/GetVersionInfo.ts @@ -9,7 +9,7 @@ export default class GetVersionInfo extends BaseAction { return { app_name: 'NapCat.Onebot', protocol_version: 'v11', - app_version: napcat_version + app_version: napcat_version, }; } } diff --git a/src/onebot/action/types.ts b/src/onebot/action/types.ts index ce7d6f6d..a513028d 100644 --- a/src/onebot/action/types.ts +++ b/src/onebot/action/types.ts @@ -1,21 +1,21 @@ export type BaseCheckResult = ValidCheckResult | InvalidCheckResult export interface ValidCheckResult { - valid: true + valid: true; - [k: string | number]: any + [k: string | number]: any; } export interface InvalidCheckResult { - valid: false - message: string + valid: false; + message: string; - [k: string | number]: any + [k: string | number]: any; } export enum ActionName { // 以下为扩展napcat扩展 - Unknown = "unknown", + Unknown = 'unknown', SharePeer = 'ArkShareGroup', ShareGroupEx = 'ArkSharePeer', RebootNormal = 'reboot_normal',//无快速登录重新启动 diff --git a/src/onebot/action/user/GetCookies.ts b/src/onebot/action/user/GetCookies.ts index 4993e08f..ea5ae709 100644 --- a/src/onebot/action/user/GetCookies.ts +++ b/src/onebot/action/user/GetCookies.ts @@ -1,17 +1,18 @@ - import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; + interface Response { - cookies: string, - bkn: string + cookies: string, + bkn: string } + const SchemaData = { type: 'object', properties: { - domain: { type: 'string' } + domain: { type: 'string' }, }, - required: ['domain'] + required: ['domain'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -19,6 +20,7 @@ type Payload = FromSchema; export class GetCookies extends BaseAction { actionName = ActionName.GetCookies; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQWebApi = this.CoreContext.getApiContext().WebApi; diff --git a/src/onebot/action/user/GetFriendList.ts b/src/onebot/action/user/GetFriendList.ts index 01be3385..f9f6c21f 100644 --- a/src/onebot/action/user/GetFriendList.ts +++ b/src/onebot/action/user/GetFriendList.ts @@ -9,13 +9,14 @@ const SchemaData = { type: 'object', properties: { no_cache: { type: ['boolean', 'string'] }, - } + }, } as const satisfies JSONSchema; type Payload = FromSchema; export default class GetFriendList extends BaseAction { actionName = ActionName.GetFriendList; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { //全新逻辑 const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi; diff --git a/src/onebot/action/user/GetRecentContact.ts b/src/onebot/action/user/GetRecentContact.ts index 2476716a..3bab0a81 100644 --- a/src/onebot/action/user/GetRecentContact.ts +++ b/src/onebot/action/user/GetRecentContact.ts @@ -1,4 +1,3 @@ - import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; @@ -7,8 +6,8 @@ import { OB11Constructor } from '@/onebot/helper/data'; const SchemaData = { type: 'object', properties: { - count: { type: ['number', 'string'] } - } + count: { type: ['number', 'string'] }, + }, } as const satisfies JSONSchema; type Payload = FromSchema; @@ -16,6 +15,7 @@ type Payload = FromSchema; export default class GetRecentContact extends BaseAction { actionName = ActionName.GetRecentContact; PayloadSchema = SchemaData; + protected async _handle(payload: Payload) { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; const NTQQMsgApi = this.CoreContext.getApiContext().MsgApi; @@ -24,7 +24,7 @@ export default class GetRecentContact extends BaseAction { const FastMsg = await NTQQMsgApi.getMsgsByMsgId({ chatType: t.chatType, peerUid: t.peerUid }, [t.msgId]); if (FastMsg.msgList.length > 0) { //扩展ret.info.changedList - const lastestMsg = await OB11Constructor.message(this.CoreContext, FastMsg.msgList[0], "array"); + const lastestMsg = await OB11Constructor.message(this.CoreContext, FastMsg.msgList[0], 'array'); return { lastestMsg: lastestMsg, peerUin: t.peerUin, @@ -34,7 +34,7 @@ export default class GetRecentContact extends BaseAction { msgId: t.msgId, sendNickName: t.sendNickName, sendMemberName: t.sendMemberName, - peerName: t.peerName + peerName: t.peerName, }; } return { @@ -45,7 +45,7 @@ export default class GetRecentContact extends BaseAction { msgId: t.msgId, sendNickName: t.sendNickName, sendMemberName: t.sendMemberName, - peerName: t.peerName + peerName: t.peerName, }; })); return data; diff --git a/src/onebot/action/user/SendLike.ts b/src/onebot/action/user/SendLike.ts index 567fad45..5372e360 100644 --- a/src/onebot/action/user/SendLike.ts +++ b/src/onebot/action/user/SendLike.ts @@ -1,4 +1,3 @@ - import BaseAction from '../BaseAction'; import { ActionName } from '../types'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; @@ -7,9 +6,9 @@ const SchemaData = { type: 'object', properties: { user_id: { type: ['number', 'string'] }, - times: { type: ['number', 'string'] } + times: { type: ['number', 'string'] }, }, - required: ['user_id', 'times'] + required: ['user_id', 'times'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -17,6 +16,7 @@ type Payload = FromSchema; export default class SendLike extends BaseAction { actionName = ActionName.SendLike; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQUserApi = this.CoreContext.getApiContext().UserApi; //logDebug('点赞参数', payload); diff --git a/src/onebot/action/user/SetFriendAddRequest.ts b/src/onebot/action/user/SetFriendAddRequest.ts index 75ac0a05..76a2d75f 100644 --- a/src/onebot/action/user/SetFriendAddRequest.ts +++ b/src/onebot/action/user/SetFriendAddRequest.ts @@ -1,16 +1,15 @@ import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import BaseAction from '../BaseAction'; import { ActionName } from '../types'; -import { NTQQFriendApi } from '@/core/apis/friend'; const SchemaData = { type: 'object', properties: { flag: { type: 'string' }, approve: { type: ['string', 'boolean'] }, - remark: { type: 'string' } + remark: { type: 'string' }, }, - required: ['flag'] + required: ['flag'], } as const satisfies JSONSchema; type Payload = FromSchema; @@ -18,6 +17,7 @@ type Payload = FromSchema; export default class SetFriendAddRequest extends BaseAction { actionName = ActionName.SetFriendAddRequest; PayloadSchema = SchemaData; + protected async _handle(payload: Payload): Promise { const NTQQFriendApi = this.CoreContext.getApiContext().FriendApi; const approve = payload.approve?.toString() !== 'false'; diff --git a/src/onebot/api/friend.ts b/src/onebot/api/friend.ts index 3082c8b4..f2ab84c9 100644 --- a/src/onebot/api/friend.ts +++ b/src/onebot/api/friend.ts @@ -1,5 +1,5 @@ -import { NapCatCore } from "@/core"; -import { NapCatOneBot11Adapter } from "../main"; +import { NapCatCore } from '@/core'; +import { NapCatOneBot11Adapter } from '../main'; export class OneBotFriendApi { obContext: NapCatOneBot11Adapter; @@ -9,4 +9,4 @@ export class OneBotFriendApi { this.obContext = obContext; this.coreContext = coreContext; } -} \ No newline at end of file +} diff --git a/src/onebot/api/group.ts b/src/onebot/api/group.ts index d501601f..375463a3 100644 --- a/src/onebot/api/group.ts +++ b/src/onebot/api/group.ts @@ -1,5 +1,6 @@ -import { NapCatCore } from "@/core"; -import { NapCatOneBot11Adapter } from "../main"; +import { NapCatCore } from '@/core'; +import { NapCatOneBot11Adapter } from '../main'; + export class OneBotGroupApi { obContext: NapCatOneBot11Adapter; coreContext: NapCatCore; @@ -8,4 +9,4 @@ export class OneBotGroupApi { this.obContext = obContext; this.coreContext = coreContext; } -} \ No newline at end of file +} diff --git a/src/onebot/api/user.ts b/src/onebot/api/user.ts index a31aa32c..5f5ad7eb 100644 --- a/src/onebot/api/user.ts +++ b/src/onebot/api/user.ts @@ -1,10 +1,12 @@ -import { NapCatCore } from "@/core"; -import { NapCatOneBot11Adapter } from "../main"; -export class OneBotUserApi{ +import { NapCatCore } from '@/core'; +import { NapCatOneBot11Adapter } from '../main'; + +export class OneBotUserApi { obContext: NapCatOneBot11Adapter; coreContext: NapCatCore; + constructor(obContext: NapCatOneBot11Adapter, coreContext: NapCatCore) { this.obContext = obContext; this.coreContext = coreContext; } -} \ No newline at end of file +} diff --git a/src/onebot/event/meta/OB11HeartbeatEvent.ts b/src/onebot/event/meta/OB11HeartbeatEvent.ts index 628f1c58..748323ce 100644 --- a/src/onebot/event/meta/OB11HeartbeatEvent.ts +++ b/src/onebot/event/meta/OB11HeartbeatEvent.ts @@ -15,7 +15,7 @@ export class OB11HeartbeatEvent extends OB11BaseMetaEvent { this.interval = interval; this.status = { online: isOnline, - good: isGood + good: isGood, }; } -} \ No newline at end of file +} diff --git a/src/onebot/event/notice/OB11GroupAdminNoticeEvent.ts b/src/onebot/event/notice/OB11GroupAdminNoticeEvent.ts index 739e772c..5d0ba149 100644 --- a/src/onebot/event/notice/OB11GroupAdminNoticeEvent.ts +++ b/src/onebot/event/notice/OB11GroupAdminNoticeEvent.ts @@ -2,5 +2,5 @@ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent'; export class OB11GroupAdminNoticeEvent extends OB11GroupNoticeEvent { notice_type = 'group_admin'; - sub_type: 'set' | 'unset' = "set"; // "set" | "unset" -} \ No newline at end of file + sub_type: 'set' | 'unset' = 'set'; // "set" | "unset" +} diff --git a/src/onebot/event/notice/OB11GroupBanEvent.ts b/src/onebot/event/notice/OB11GroupBanEvent.ts index d28de97e..ef867487 100644 --- a/src/onebot/event/notice/OB11GroupBanEvent.ts +++ b/src/onebot/event/notice/OB11GroupBanEvent.ts @@ -6,7 +6,7 @@ export class OB11GroupBanEvent extends OB11GroupNoticeEvent { duration: number; sub_type: 'ban' | 'lift_ban'; - constructor(groupId: number, userId: number, operatorId: number, duration: number, sub_type: 'ban' | 'lift_ban') { + constructor(groupId: number, userId: number, operatorId: number, duration: number, sub_type: 'ban' | 'lift_ban') { super(); this.group_id = groupId; this.operator_id = operatorId; diff --git a/src/onebot/event/notice/OB11GroupEssenceEvent.ts b/src/onebot/event/notice/OB11GroupEssenceEvent.ts index 80c714bc..0f1c6184 100644 --- a/src/onebot/event/notice/OB11GroupEssenceEvent.ts +++ b/src/onebot/event/notice/OB11GroupEssenceEvent.ts @@ -1,4 +1,5 @@ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent'; + export class OB11GroupEssenceEvent extends OB11GroupNoticeEvent { notice_type = 'essence'; message_id: number; diff --git a/src/onebot/event/notice/OB11GroupIncreaseEvent.ts b/src/onebot/event/notice/OB11GroupIncreaseEvent.ts index 51500c39..ee96b344 100644 --- a/src/onebot/event/notice/OB11GroupIncreaseEvent.ts +++ b/src/onebot/event/notice/OB11GroupIncreaseEvent.ts @@ -1,10 +1,12 @@ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent'; type GroupIncreaseSubType = 'approve' | 'invite'; + export class OB11GroupIncreaseEvent extends OB11GroupNoticeEvent { notice_type = 'group_increase'; operator_id: number; sub_type: GroupIncreaseSubType; + constructor(groupId: number, userId: number, operatorId: number, subType: GroupIncreaseSubType = 'approve') { super(); this.group_id = groupId; diff --git a/src/onebot/event/notice/OB11GroupUploadNoticeEvent.ts b/src/onebot/event/notice/OB11GroupUploadNoticeEvent.ts index c907a672..9304e107 100644 --- a/src/onebot/event/notice/OB11GroupUploadNoticeEvent.ts +++ b/src/onebot/event/notice/OB11GroupUploadNoticeEvent.ts @@ -1,6 +1,6 @@ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent'; -export interface GroupUploadFile{ +export interface GroupUploadFile { id: string, name: string, size: number, @@ -17,4 +17,4 @@ export class OB11GroupUploadNoticeEvent extends OB11GroupNoticeEvent { this.user_id = userId; this.file = file; } -} \ No newline at end of file +} diff --git a/src/onebot/event/notice/OB11InputStatusEvent.ts b/src/onebot/event/notice/OB11InputStatusEvent.ts index d9185181..b26a8195 100644 --- a/src/onebot/event/notice/OB11InputStatusEvent.ts +++ b/src/onebot/event/notice/OB11InputStatusEvent.ts @@ -1,12 +1,14 @@ import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent'; + //输入状态事件 初步完成 Mlikio wa Todo 需要做一些过滤 export class OB11InputStatusEvent extends OB11BaseNoticeEvent { notice_type = 'notify'; sub_type = 'input_status'; - status_text = "对方正在输入..."; + status_text = '对方正在输入...'; eventType = 1; user_id = 0; group_id = 0; + constructor(user_id: number, eventType: number, status_text: string) { super(); this.user_id = user_id; diff --git a/src/onebot/event/notice/OB11MsgEmojiLikeEvent.ts b/src/onebot/event/notice/OB11MsgEmojiLikeEvent.ts index 8fc9b445..db48575e 100644 --- a/src/onebot/event/notice/OB11MsgEmojiLikeEvent.ts +++ b/src/onebot/event/notice/OB11MsgEmojiLikeEvent.ts @@ -1,8 +1,8 @@ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent'; export interface MsgEmojiLike { - emoji_id: string, - count: number + emoji_id: string, + count: number } export class OB11GroupMsgEmojiLikeEvent extends OB11GroupNoticeEvent { diff --git a/src/onebot/event/notice/OB11PokeEvent.ts b/src/onebot/event/notice/OB11PokeEvent.ts index 22592d89..315636ff 100644 --- a/src/onebot/event/notice/OB11PokeEvent.ts +++ b/src/onebot/event/notice/OB11PokeEvent.ts @@ -9,6 +9,7 @@ class OB11PokeEvent extends OB11BaseNoticeEvent { export class OB11FriendPokeEvent extends OB11PokeEvent { raw_info: any; + //raw_message nb等框架标准为string constructor(user_id: number, target_id: number, raw_message: any) { super(); @@ -21,6 +22,7 @@ export class OB11FriendPokeEvent extends OB11PokeEvent { export class OB11GroupPokeEvent extends OB11PokeEvent { group_id: number; raw_info: any; + //raw_message nb等框架标准为string constructor(group_id: number, user_id: number = 0, target_id: number = 0, raw_message: any) { super(); diff --git a/src/onebot/helper/config.ts b/src/onebot/helper/config.ts index 581f87fd..3b948157 100644 --- a/src/onebot/helper/config.ts +++ b/src/onebot/helper/config.ts @@ -1,40 +1,41 @@ import { ConfigBase } from '@/common/utils/ConfigBase'; export interface OB11Config { - http: { - enable: boolean; - host: string; - port: number; - secret: string; - enableHeart: boolean; - enablePost: boolean; - postUrls: string[]; - }; - ws: { - enable: boolean; - host: string; - port: number; - }; - reverseWs: { - enable: boolean; - urls: string[]; - }; + http: { + enable: boolean; + host: string; + port: number; + secret: string; + enableHeart: boolean; + enablePost: boolean; + postUrls: string[]; + }; + ws: { + enable: boolean; + host: string; + port: number; + }; + reverseWs: { + enable: boolean; + urls: string[]; + }; - debug: boolean; - heartInterval: number; - messagePostFormat: 'array' | 'string'; - enableLocalFile2Url: boolean; - musicSignUrl: string; - reportSelfMessage: boolean; - token: string; - GroupLocalTime: { - Record: boolean, - RecordList: Array - } + debug: boolean; + heartInterval: number; + messagePostFormat: 'array' | 'string'; + enableLocalFile2Url: boolean; + musicSignUrl: string; + reportSelfMessage: boolean; + token: string; + GroupLocalTime: { + Record: boolean, + RecordList: Array + }; } -export class OB11Config extends ConfigBase { +export class OB11Config extends ConfigBase { name = 'onebot11'; + protected getKeys(): string[] | null { return null; } diff --git a/src/onebot/helper/data.ts b/src/onebot/helper/data.ts index cf5350a1..ae9d8dcd 100644 --- a/src/onebot/helper/data.ts +++ b/src/onebot/helper/data.ts @@ -1,4 +1,4 @@ -import fastXmlParser, { XMLParser } from 'fast-xml-parser'; +import fastXmlParser from 'fast-xml-parser'; import { OB11Group, OB11GroupMember, @@ -7,7 +7,7 @@ import { OB11MessageData, OB11MessageDataType, OB11User, - OB11UserSex + OB11UserSex, } from '../types'; import { AtType, @@ -24,7 +24,7 @@ import { Sex, TipGroupElementType, User, - VideoElement + VideoElement, } from '@/core/entities'; import { EventType } from '../event/OB11BaseEvent'; import { encodeCQCode } from './cqcode'; @@ -32,12 +32,9 @@ import { OB11GroupIncreaseEvent } from '../event/notice/OB11GroupIncreaseEvent'; import { OB11GroupBanEvent } from '../event/notice/OB11GroupBanEvent'; import { OB11GroupUploadNoticeEvent } from '../event/notice/OB11GroupUploadNoticeEvent'; import { OB11GroupNoticeEvent } from '../event/notice/OB11GroupNoticeEvent'; -import { calcQQLevel } from '@/common/utils/helper'; -import { sleep, UUIDConverter } from '@/common/utils/helper'; +import { calcQQLevel, sleep, UUIDConverter } from '@/common/utils/helper'; import { OB11GroupTitleEvent } from '../event/notice/OB11GroupTitleEvent'; -import { OB11GroupCardEvent } from '../event/notice/OB11GroupCardEvent'; import { OB11GroupDecreaseEvent } from '../event/notice/OB11GroupDecreaseEvent'; -import { NTQQFileApi, NTQQGroupApi, NTQQMsgApi, NTQQUserApi } from '@/core/apis'; import { OB11GroupMsgEmojiLikeEvent } from '@/onebot/event/notice/OB11MsgEmojiLikeEvent'; import { OB11FriendPokeEvent, OB11GroupPokeEvent } from '../event/notice/OB11PokeEvent'; import { OB11FriendAddNoticeEvent } from '../event/notice/OB11FriendAddNoticeEvent'; @@ -86,28 +83,25 @@ export class OB11Constructor { resMsg.sender.role = OB11Constructor.groupMemberRole(member.role); resMsg.sender.nickname = member.nick; } - } - else if (msg.chatType == ChatType.friend) { + } else if (msg.chatType == ChatType.friend) { resMsg.sub_type = 'friend'; resMsg.sender.nickname = (await NTQQUserApi.getUserDetailInfo(msg.senderUid)).nick; //const user = await NTQQUserApi.getUserDetailInfoByUin(msg.senderUin!); //resMsg.sender.nickname = user.info.nick; - } - else if (msg.chatType == ChatType.temp) { + } else if (msg.chatType == ChatType.temp) { resMsg.sub_type = 'group'; } for (const element of msg.elements) { let message_data: OB11MessageData = { data: {} as any, - type: 'unknown' as any + type: 'unknown' as any, }; if (element.textElement && element.textElement?.atType !== AtType.notAt) { let qq: `${number}` | 'all'; let name: string | undefined; if (element.textElement.atType == AtType.atAll) { qq = 'all'; - } - else { + } else { const { atNtUid, content } = element.textElement; let atQQ = element.textElement.atUid; if (!atQQ || atQQ === '0') { @@ -122,11 +116,10 @@ export class OB11Constructor { type: OB11MessageDataType.at, data: { qq: qq!, - name - } + name, + }, }; - } - else if (element.textElement) { + } else if (element.textElement) { message_data['type'] = OB11MessageDataType.text; let text = element.textElement.content; @@ -138,8 +131,7 @@ export class OB11Constructor { text = text.replace(/\r/g, '\n'); } message_data['data']['text'] = text; - } - else if (element.replyElement) { + } else if (element.replyElement) { message_data['type'] = OB11MessageDataType.reply; //log("收到回复消息", element.replyElement); try { @@ -151,7 +143,11 @@ export class OB11Constructor { }; let replyMsg: RawMessage | undefined; if (!records) throw new Error('找不到回复消息'); - replyMsg = (await NTQQMsgApi.getMsgsBySeqAndCount({ peerUid: msg.peerUid, guildId: '', chatType: msg.chatType }, element.replyElement.replayMsgSeq, 1, true, true)).msgList[0]; + replyMsg = (await NTQQMsgApi.getMsgsBySeqAndCount({ + peerUid: msg.peerUid, + guildId: '', + chatType: msg.chatType, + }, element.replyElement.replayMsgSeq, 1, true, true)).msgList[0]; if (!replyMsg || records.msgRandom !== replyMsg.msgRandom) { replyMsg = (await NTQQMsgApi.getSingleMsg(peer, element.replyElement.replayMsgSeq)).msgList[0]; } @@ -161,7 +157,11 @@ export class OB11Constructor { if ((!replyMsg || records.msgRandom !== replyMsg.msgRandom) && msg.peerUin !== '284840486') { throw new Error('回复消息消息验证失败'); } - message_data['data']['id'] = MessageUnique.createMsg({ peerUid: msg.peerUid, guildId: '', chatType: msg.chatType }, replyMsg.msgId)?.toString(); + message_data['data']['id'] = MessageUnique.createMsg({ + peerUid: msg.peerUid, + guildId: '', + chatType: msg.chatType, + }, replyMsg.msgId)?.toString(); //log("找到回复消息", message_data['data']['id'], replyMsg.msgList[0].msgId) } catch (e: any) { message_data['type'] = 'unknown' as any; @@ -169,8 +169,7 @@ export class OB11Constructor { logger.logError('获取不到引用的消息', e.stack, element.replyElement.replayMsgSeq); } - } - else if (element.picElement) { + } else if (element.picElement) { message_data['type'] = OB11MessageDataType.image; // message_data["data"]["file"] = element.picElement.sourcePath message_data['data']['file'] = element.picElement.fileName; @@ -186,8 +185,7 @@ export class OB11Constructor { //console.log(message_data['data']['url']) // message_data["data"]["file_id"] = element.picElement.fileUuid message_data['data']['file_size'] = element.picElement.fileSize; - } - else if (element.fileElement) { + } else if (element.fileElement) { const FileElement = element.fileElement; message_data['type'] = OB11MessageDataType.file; message_data['data']['file'] = FileElement.fileName; @@ -195,21 +193,21 @@ export class OB11Constructor { message_data['data']['url'] = FileElement.filePath; message_data['data']['file_id'] = UUIDConverter.encode(msg.peerUin, msg.msgId); message_data['data']['file_size'] = FileElement.fileSize; - await NTQQFileApi.addFileCache({ - peerUid: msg.peerUid, - chatType: msg.chatType, - guildId: '', - }, - msg.msgId, - msg.msgSeq, - msg.senderUid, - element.elementId, - element.elementType.toString(), - FileElement.fileSize, - FileElement.fileName + await NTQQFileApi.addFileCache( + { + peerUid: msg.peerUid, + chatType: msg.chatType, + guildId: '', + }, + msg.msgId, + msg.msgSeq, + msg.senderUid, + element.elementId, + element.elementType.toString(), + FileElement.fileSize, + FileElement.fileName, ); - } - else if (element.videoElement) { + } else if (element.videoElement) { const videoElement: VideoElement = element.videoElement; //读取视频链接并兜底 let videoUrl;//Array @@ -221,7 +219,7 @@ export class OB11Constructor { videoUrl = await NTQQFileApi.getVideoUrl({ chatType: msg.chatType, peerUid: msg.peerUid, - guildId: '0' + guildId: '0', }, msg.msgId, element.elementId); } catch (error) { videoUrl = undefined; @@ -230,7 +228,12 @@ export class OB11Constructor { let videoDownUrl = undefined; if (videoUrl) { - const videoDownUrlTemp = videoUrl.find((url) => { if (url.url) { return true; } return false; }); + const videoDownUrlTemp = videoUrl.find((url) => { + if (url.url) { + return true; + } + return false; + }); if (videoDownUrlTemp) { videoDownUrl = videoDownUrlTemp.url; } @@ -246,21 +249,21 @@ export class OB11Constructor { message_data['data']['file_id'] = UUIDConverter.encode(msg.peerUin, msg.msgId); message_data['data']['file_size'] = videoElement.fileSize; - await NTQQFileApi.addFileCache({ - peerUid: msg.peerUid, - chatType: msg.chatType, - guildId: '', - }, - msg.msgId, - msg.msgSeq, - msg.senderUid, - element.elementId, - element.elementType.toString(), - videoElement.fileSize || '0', - videoElement.fileName + await NTQQFileApi.addFileCache( + { + peerUid: msg.peerUid, + chatType: msg.chatType, + guildId: '', + }, + msg.msgId, + msg.msgSeq, + msg.senderUid, + element.elementId, + element.elementType.toString(), + videoElement.fileSize || '0', + videoElement.fileName, ); - } - else if (element.pttElement) { + } else if (element.pttElement) { message_data['type'] = OB11MessageDataType.voice; message_data['data']['file'] = element.pttElement.fileName; message_data['data']['path'] = element.pttElement.filePath; @@ -278,30 +281,25 @@ export class OB11Constructor { element.elementId, element.elementType.toString(), element.pttElement.fileSize || '0', - element.pttElement.fileUuid || '' + element.pttElement.fileUuid || '', ); //以uuid作为文件名 - } - else if (element.arkElement) { + } else if (element.arkElement) { message_data['type'] = OB11MessageDataType.json; message_data['data']['data'] = element.arkElement.bytesData; - } - else if (element.faceElement) { + } else if (element.faceElement) { const faceId = element.faceElement.faceIndex; if (faceId === FaceIndex.dice) { message_data['type'] = OB11MessageDataType.dice; message_data['data']['result'] = element.faceElement.resultId; - } - else if (faceId === FaceIndex.RPS) { + } else if (faceId === FaceIndex.RPS) { message_data['type'] = OB11MessageDataType.RPS; message_data['data']['result'] = element.faceElement.resultId; - } - else { + } else { message_data['type'] = OB11MessageDataType.face; message_data['data']['id'] = element.faceElement.faceIndex.toString(); } - } - else if (element.marketFaceElement) { + } else if (element.marketFaceElement) { message_data['type'] = OB11MessageDataType.mface; message_data['data']['summary'] = element.marketFaceElement.faceName; const md5 = element.marketFaceElement.emojiId; @@ -315,15 +313,17 @@ export class OB11Constructor { message_data['data']['emoji_package_id'] = String(element.marketFaceElement.emojiPackageId); message_data['data']['key'] = element.marketFaceElement.key; //mFaceCache.set(md5, element.marketFaceElement.faceName); - } - else if (element.markdownElement) { + } else if (element.markdownElement) { message_data['type'] = OB11MessageDataType.markdown; message_data['data']['data'] = element.markdownElement.content; - } - else if (element.multiForwardMsgElement) { + } else if (element.multiForwardMsgElement) { message_data['type'] = OB11MessageDataType.forward; message_data['data']['id'] = msg.msgId; - const ParentMsgPeer = msg.parentMsgPeer ?? { chatType: msg.chatType, guildId: '', peerUid: msg.peerUid }; + const ParentMsgPeer = msg.parentMsgPeer ?? { + chatType: msg.chatType, + guildId: '', + peerUid: msg.peerUid, + }; //判断是否在合并消息内 msg.parentMsgIdList = msg.parentMsgIdList ?? []; //首次列表不存在则开始创建 @@ -340,7 +340,7 @@ export class OB11Constructor { MultiMsg.parentMsgPeer = ParentMsgPeer; MultiMsg.parentMsgIdList = msg.parentMsgIdList; MultiMsg.id = MessageUnique.createMsg(ParentMsgPeer, MultiMsg.msgId);//该ID仅用查看 无法调用 - const msgList = await OB11Constructor.message(coreContext, MultiMsg, "array"); + const msgList = await OB11Constructor.message(coreContext, MultiMsg, 'array'); message_data['data']['content'].push(msgList); //console.log("合并消息", msgList); } @@ -350,8 +350,7 @@ export class OB11Constructor { if (messagePostFormat === 'string') { (resMsg.message as string) += cqCode; - } - else (resMsg.message as OB11MessageData[]).push(message_data); + } else (resMsg.message as OB11MessageData[]).push(message_data); resMsg.raw_message += cqCode; } @@ -359,6 +358,7 @@ export class OB11Constructor { resMsg.raw_message = resMsg.raw_message.trim(); return resMsg; } + static async PrivateEvent(coreContext: NapCatCore, msg: RawMessage): Promise { const NTQQGroupApi = coreContext.getApiContext().GroupApi; const NTQQUserApi = coreContext.getApiContext().UserApi; @@ -396,7 +396,8 @@ export class OB11Constructor { } } } - static async GroupEvent(coreContext:NapCatCore,msg: RawMessage): Promise { + + static async GroupEvent(coreContext: NapCatCore, msg: RawMessage): Promise { const NTQQGroupApi = coreContext.getApiContext().GroupApi; const NTQQUserApi = coreContext.getApiContext().UserApi; const NTQQFileApi = coreContext.getApiContext().FileApi; @@ -440,8 +441,7 @@ export class OB11Constructor { // log("构造群增加事件", event) return event; } - } - else if (groupElement.type === TipGroupElementType.ban) { + } else if (groupElement.type === TipGroupElementType.ban) { logger.logDebug('收到群群员禁言提示', groupElement); const memberUid = groupElement.shutUp!.member.uid; const adminUid = groupElement.shutUp!.admin.uid; @@ -451,8 +451,7 @@ export class OB11Constructor { // log('OB11被禁言事件', adminUid); if (memberUid) { memberUin = (await getGroupMember(msg.peerUid, memberUid))?.uin || ''; // || (await NTQQUserApi.getUserDetailInfo(memberUid))?.uin - } - else { + } else { memberUin = '0'; // 0表示全员禁言 if (duration > 0) { duration = -1; @@ -464,8 +463,7 @@ export class OB11Constructor { const event = new OB11GroupBanEvent(parseInt(msg.peerUid), parseInt(memberUin), parseInt(adminUin), duration, sub_type); return event; } - } - else if (groupElement.type == TipGroupElementType.kicked) { + } else if (groupElement.type == TipGroupElementType.kicked) { logger.logDebug(`收到我被踢出或退群提示, 群${msg.peerUid}`, groupElement); NTQQGroupApi.quitGroup(msg.peerUid).then(); try { @@ -477,13 +475,12 @@ export class OB11Constructor { return new OB11GroupDecreaseEvent(parseInt(msg.peerUid), parseInt(coreContext.selfInfo.uin), 0, 'leave'); } } - } - else if (element.fileElement) { + } else if (element.fileElement) { return new OB11GroupUploadNoticeEvent(parseInt(msg.peerUid), parseInt(msg.senderUin || ''), { id: element.fileElement.fileUuid!, name: element.fileElement.fileName, size: parseInt(element.fileElement.fileSize), - busid: element.fileElement.fileBizId || 0 + busid: element.fileElement.fileBizId || 0, }); } if (grayTipElement) { @@ -491,7 +488,7 @@ export class OB11Constructor { if (grayTipElement.xmlElement?.templId === '10382') { const emojiLikeData = new fastXmlParser.XMLParser({ ignoreAttributes: false, - attributeNamePrefix: '' + attributeNamePrefix: '', }).parse(grayTipElement.xmlElement.content); logger.logDebug('收到表情回应我的消息', emojiLikeData); try { @@ -499,21 +496,25 @@ export class OB11Constructor { const msgSeq = emojiLikeData.gtip.url.msgseq; const emojiId = emojiLikeData.gtip.face.id; - const replyMsgList = (await NTQQMsgApi.getMsgsBySeqAndCount({ chatType: ChatType.group, guildId: '', peerUid: msg.peerUid }, msgSeq, 1, true, true)).msgList; + const replyMsgList = (await NTQQMsgApi.getMsgsBySeqAndCount({ + chatType: ChatType.group, + guildId: '', + peerUid: msg.peerUid, + }, msgSeq, 1, true, true)).msgList; if (replyMsgList.length < 1) { return; } const replyMsg = replyMsgList[0]; - console.log('表情回应消息', msgSeq, " 结算ID", replyMsg.msgId); + console.log('表情回应消息', msgSeq, ' 结算ID', replyMsg.msgId); return new OB11GroupMsgEmojiLikeEvent( parseInt(msg.peerUid), parseInt(senderUin), MessageUnique.getShortIdByMsgId(replyMsg.msgId)!, [{ emoji_id: emojiId, - count: 1 - }] + count: 1, + }], ); } catch (e: any) { logger.logError('解析表情回应消息失败', e.stack); @@ -559,7 +560,7 @@ export class OB11Constructor { const Peer: Peer = { guildId: '', chatType: ChatType.group, - peerUid: Group! + peerUid: Group!, }; const msgData = await NTQQMsgApi.getMsgsBySeqAndCount(Peer, msgSeq.toString(), 1, true, true); return new OB11GroupEssenceEvent(parseInt(msg.peerUid), MessageUnique.getShortIdByMsgId(msgData.msgList[0].msgId)!, parseInt(msgData.msgList[0].senderUin)); @@ -576,13 +577,14 @@ export class OB11Constructor { } } } + static friend(friend: User): OB11User { return { user_id: parseInt(friend.uin), nickname: friend.nick, remark: friend.remark, sex: OB11Constructor.sex(friend.sex!), - level: friend.qqLevel && calcQQLevel(friend.qqLevel) || 0 + level: friend.qqLevel && calcQQLevel(friend.qqLevel) || 0, }; } @@ -592,6 +594,7 @@ export class OB11Constructor { nickname: selfInfo.nick, }; } + static friendsV2(friends: FriendV2[]): OB11User[] { const data: OB11User[] = []; friends.forEach(friend => { @@ -605,16 +608,23 @@ export class OB11Constructor { sex: sexValue, level: 0, categroyName: friend.categroyName, - categoryId: friend.categoryId + categoryId: friend.categoryId, }); }); return data; } + static friends(friends: Friend[]): OB11User[] { const data: OB11User[] = []; friends.forEach(friend => { const sexValue = this.sex(friend.sex!); - data.push({ user_id: parseInt(friend.uin), nickname: friend.nick, remark: friend.remark, sex: sexValue, level: 0 }); + data.push({ + user_id: parseInt(friend.uin), + nickname: friend.nick, + remark: friend.remark, + sex: sexValue, + level: 0, + }); }); return data; } @@ -623,7 +633,7 @@ export class OB11Constructor { return { 4: OB11GroupMemberRole.owner, 3: OB11GroupMemberRole.admin, - 2: OB11GroupMemberRole.member + 2: OB11GroupMemberRole.member, }[role]; } @@ -631,7 +641,7 @@ export class OB11Constructor { const sexMap = { [Sex.male]: OB11UserSex.male, [Sex.female]: OB11UserSex.female, - [Sex.unknown]: OB11UserSex.unknown + [Sex.unknown]: OB11UserSex.unknown, }; return sexMap[sex] || OB11UserSex.unknown; } @@ -660,7 +670,7 @@ export class OB11Constructor { } static stranger(user: User): OB11User { - //logDebug('construct ob11 stranger', user); + //logDebug('construct ob11 stranger', user); return { ...user, user_id: parseInt(user.uin), @@ -679,7 +689,7 @@ export class OB11Constructor { group_id: parseInt(group.groupCode), group_name: group.groupName, member_count: group.memberCount, - max_member_count: group.maxMember + max_member_count: group.maxMember, }; } diff --git a/src/onebot/helper/log.ts b/src/onebot/helper/log.ts index 130104a8..5a0eb9a8 100644 --- a/src/onebot/helper/log.ts +++ b/src/onebot/helper/log.ts @@ -7,94 +7,80 @@ const spColor = chalk.cyan;// for special // todo: 应该放到core去用RawMessage解析打印 export async function logMessage(coreContext: NapCatCore, ob11Message: OB11Message) { - const isSelfSent = ob11Message.sender.user_id.toString() === coreContext.selfInfo.uin; - let prefix = ''; - let group: Group | undefined; - if (isSelfSent) { - prefix = '发送消息 '; - if (ob11Message.message_type === 'private') { - prefix += '给私聊 '; - prefix += `${ob11Message.target_id}`; + const isSelfSent = ob11Message.sender.user_id.toString() === coreContext.selfInfo.uin; + let prefix = ''; + let group: Group | undefined; + if (isSelfSent) { + prefix = '发送消息 '; + if (ob11Message.message_type === 'private') { + prefix += '给私聊 '; + prefix += `${ob11Message.target_id}`; + } else { + prefix += '给群聊 '; + } } - else { - prefix += '给群聊 '; + if (ob11Message.message_type === 'group') { + if (ob11Message.group_id == 284840486) { + group = await getGroup(ob11Message.group_id!); + prefix += '转发消息[外部来源] '; + } else { + group = await getGroup(ob11Message.group_id!); + prefix += `群[${group?.groupName}(${ob11Message.group_id})] `; + } } - } - if (ob11Message.message_type === 'group') { - if (ob11Message.group_id == 284840486) { - group = await getGroup(ob11Message.group_id!); - prefix += '转发消息[外部来源] '; + let msgChain = ''; + if (Array.isArray(ob11Message.message)) { + const msgParts = []; + for (const segment of ob11Message.message) { + if (segment.type === 'text') { + msgParts.push(segment.data.text); + } else if (segment.type === 'at') { + const groupMember = await getGroupMember(ob11Message.group_id!, segment.data.qq!); + msgParts.push(spSegColor(`[@${groupMember?.cardName || groupMember?.nick}(${segment.data.qq})]`)); + } else if (segment.type === 'reply') { + msgParts.push(spSegColor(`[回复消息|id:${segment.data.id}]`)); + } else if (segment.type === 'image') { + msgParts.push(spSegColor(`[图片|${segment.data.url}]`)); + } else if (segment.type === 'face') { + msgParts.push(spSegColor(`[表情|id:${segment.data.id}]`)); + } else if (segment.type === 'mface') { + // @ts-expect-error 商城表情 url + msgParts.push(spSegColor(`[商城表情|${segment.data.url}]`)); + } else if (segment.type === 'record') { + msgParts.push(spSegColor(`[语音|${segment.data.file}]`)); + } else if (segment.type === 'file') { + msgParts.push(spSegColor(`[文件|${segment.data.file}]`)); + } else if (segment.type === 'json') { + msgParts.push(spSegColor(`[json|${JSON.stringify(segment.data)}]`)); + } else if (segment.type === 'markdown') { + msgParts.push(spSegColor(`[markdown|${segment.data.content}]`)); + } else if (segment.type === 'video') { + msgParts.push(spSegColor(`[视频|${segment.data.url}]`)); + } else if (segment.type === 'forward') { + msgParts.push(spSegColor(`[转发|${segment.data.id}|消息开始]`)); + segment.data.content.forEach((msg) => { + logMessage(coreContext, msg); + }); + msgParts.push(spSegColor(`[转发|${segment.data.id}|消息结束]`)); + } else { + msgParts.push(spSegColor(`[未实现|${JSON.stringify(segment)}]`)); + } + } + msgChain = msgParts.join(' '); } else { - group = await getGroup(ob11Message.group_id!); - prefix += `群[${group?.groupName}(${ob11Message.group_id})] `; + msgChain = ob11Message.message; } - } - let msgChain = ''; - if (Array.isArray(ob11Message.message)) { - const msgParts = []; - for (const segment of ob11Message.message) { - if (segment.type === 'text') { - msgParts.push(segment.data.text); - } - else if (segment.type === 'at') { - const groupMember = await getGroupMember(ob11Message.group_id!, segment.data.qq!); - msgParts.push(spSegColor(`[@${groupMember?.cardName || groupMember?.nick}(${segment.data.qq})]`)); - } - else if (segment.type === 'reply') { - msgParts.push(spSegColor(`[回复消息|id:${segment.data.id}]`)); - } - else if (segment.type === 'image') { - msgParts.push(spSegColor(`[图片|${segment.data.url}]`)); - } - else if (segment.type === 'face') { - msgParts.push(spSegColor(`[表情|id:${segment.data.id}]`)); - } - else if (segment.type === 'mface') { - // @ts-expect-error 商城表情 url - msgParts.push(spSegColor(`[商城表情|${segment.data.url}]`)); - } - else if (segment.type === 'record') { - msgParts.push(spSegColor(`[语音|${segment.data.file}]`)); - } - else if (segment.type === 'file') { - msgParts.push(spSegColor(`[文件|${segment.data.file}]`)); - } - else if (segment.type === 'json') { - msgParts.push(spSegColor(`[json|${JSON.stringify(segment.data)}]`)); - } - else if (segment.type === 'markdown') { - msgParts.push(spSegColor(`[markdown|${segment.data.content}]`)); - } - else if (segment.type === 'video') { - msgParts.push(spSegColor(`[视频|${segment.data.url}]`)); - } - else if (segment.type === 'forward') { - msgParts.push(spSegColor(`[转发|${segment.data.id}|消息开始]`)); - segment.data.content.forEach((msg) => { - logMessage(coreContext, msg); - }); - msgParts.push(spSegColor(`[转发|${segment.data.id}|消息结束]`)); - } - else { - msgParts.push(spSegColor(`[未实现|${JSON.stringify(segment)}]`)); - } + let msgString = `${prefix}${ob11Message.sender.nickname}(${ob11Message.sender.user_id}): ${msgChain}`; + if (isSelfSent) { + msgString = `${prefix}: ${msgChain}`; } - msgChain = msgParts.join(' '); - } - else { - msgChain = ob11Message.message; - } - let msgString = `${prefix}${ob11Message.sender.nickname}(${ob11Message.sender.user_id}): ${msgChain}`; - if (isSelfSent) { - msgString = `${prefix}: ${msgChain}`; - } - coreContext.context.logger.log(msgString); + coreContext.context.logger.log(msgString); } export async function logNotice(coreContext: NapCatCore, ob11Notice: any) { - coreContext.context.logger.log(spColor('[Notice]'), ob11Notice); + coreContext.context.logger.log(spColor('[Notice]'), ob11Notice); } export async function logRequest(coreContext: NapCatCore, ob11Request: any) { - coreContext.context.logger.log(spColor('[Request]'), ob11Request); + coreContext.context.logger.log(spColor('[Request]'), ob11Request); } diff --git a/src/onebot/helper/msg.ts b/src/onebot/helper/msg.ts index 6720644a..33416b3e 100644 --- a/src/onebot/helper/msg.ts +++ b/src/onebot/helper/msg.ts @@ -1,38 +1,43 @@ import { AtType, - ElementType, FaceIndex, FaceType, NapCatCore, PicElement, + ElementType, + FaceIndex, + FaceType, + NapCatCore, PicType, SendArkElement, SendFaceElement, - SendFileElement, SendMarkdownElement, SendMarketFaceElement, + SendFileElement, + SendMarkdownElement, + SendMarketFaceElement, SendPicElement, SendPttElement, SendReplyElement, sendShareLocationElement, SendTextElement, SendVideoElement, - viedo_type + viedo_type, } from '@/core'; import { promises as fs } from 'node:fs'; import ffmpeg from 'fluent-ffmpeg'; -import { NTQQFileApi } from '@/core/apis/file'; import { calculateFileMD5, isGIF } from '@/common/utils/file'; import { defaultVideoThumb, getVideoInfo } from '@/common/utils/video'; import { encodeSilk } from '@/common/utils/audio'; -import { isNull } from '@/common/utils/helper'; import faceConfig from '@/core/external/face_config.json'; import * as pathLib from 'node:path'; + export class SendMsgElementConstructor { static location(CoreContext: NapCatCore): sendShareLocationElement { return { elementType: ElementType.SHARELOCATION, elementId: '', shareLocationElement: { - text: "测试", - ext: "" - } + text: '测试', + ext: '', + }, }; } + static text(CoreContext: NapCatCore, content: string): SendTextElement { return { elementType: ElementType.TEXT, @@ -70,7 +75,7 @@ export class SendMsgElementConstructor { replayMsgId: msgId, // raw.msgId senderUin: senderUin, senderUinStr: senderUinStr, - } + }, }; } @@ -99,7 +104,7 @@ export class SendMsgElementConstructor { fileUuid: '', fileSubId: '', thumbFileSize: 0, - summary + summary, }; //logDebug('图片信息', picElement); return { @@ -128,7 +133,7 @@ export class SendMsgElementConstructor { folderId: folderId, 'filePath': path!, 'fileSize': (fileSize).toString(), - } + }, }; return element; @@ -153,7 +158,7 @@ export class SendMsgElementConstructor { time: 15, format: 'mp4', size: fileSize, - filePath + filePath, }; try { videoInfo = await getVideoInfo(path, logger); @@ -183,7 +188,7 @@ export class SendMsgElementConstructor { timestamps: [0], filename: thumbFileName, folder: thumb, - size: videoInfo.width + 'x' + videoInfo.height + size: videoInfo.width + 'x' + videoInfo.height, }).on('end', () => { resolve(thumbPath); }); @@ -219,7 +224,7 @@ export class SendMsgElementConstructor { // fileFormat: 2, // import_rich_media_context: null, // sourceVideoCodecFormat: 2 - } + }, }; return element; } @@ -231,7 +236,11 @@ export class SendMsgElementConstructor { const NTQQMsgApi = coreContext.getApiContext().MsgApi; const NTQQFriendApi = coreContext.getApiContext().FriendApi; const logger = coreContext.context.logger; - const { converted, path: silkPath, duration } = await encodeSilk(pttPath, coreContext.NapCatTempPath, coreContext.context.logger); + const { + converted, + path: silkPath, + duration, + } = await encodeSilk(pttPath, coreContext.NapCatTempPath, coreContext.context.logger); // log("生成语音", silkPath, duration); if (!silkPath) { throw '语音转换失败, 请检查语音文件是否正常'; @@ -263,9 +272,10 @@ export class SendMsgElementConstructor { fileSubId: '', playState: 1, autoConvertText: 0, - } + }, }; } + // NodeIQQNTWrapperSession sendMsg [ // "0", // { @@ -289,7 +299,7 @@ export class SendMsgElementConstructor { // {} // ] static face(CoreContext: NapCatCore, faceId: number): SendFaceElement { - // 从face_config.json中获取表情名称 + // 从face_config.json中获取表情名称 const sysFaces = faceConfig.sysface; const emojiFaces = faceConfig.emoji; const face: any = sysFaces.find((face) => face.QSid === faceId.toString()); @@ -330,7 +340,7 @@ export class SendMsgElementConstructor { } static dice(CoreContext: NapCatCore, resultId: number | null): SendFaceElement { - // 实际测试并不能控制结果 + // 实际测试并不能控制结果 // 随机1到6 // if (isNull(resultId)) resultId = Math.floor(Math.random() * 6) + 1; @@ -348,14 +358,14 @@ export class SendMsgElementConstructor { // resultId: resultId.toString(), 'surpriseId': '', // "randomType": 1, - } + }, }; } // 猜拳(石头剪刀布)表情 static rps(CoreContext: NapCatCore, resultId: number | null): SendFaceElement { - // 实际测试并不能控制结果 - // if (isNull(resultId)) resultId = Math.floor(Math.random() * 3) + 1; + // 实际测试并不能控制结果 + // if (isNull(resultId)) resultId = Math.floor(Math.random() * 3) + 1; return { elementType: ElementType.FACE, elementId: '', @@ -370,7 +380,7 @@ export class SendMsgElementConstructor { // 'resultId': resultId.toString(), 'surpriseId': '', // "randomType": 1, - } + }, }; } @@ -384,8 +394,8 @@ export class SendMsgElementConstructor { arkElement: { bytesData: data, linkInfo: null, - subElementType: null - } + subElementType: null, + }, }; } @@ -394,8 +404,8 @@ export class SendMsgElementConstructor { elementType: ElementType.MARKDOWN, elementId: '', markdownElement: { - content - } + content, + }, }; } } diff --git a/src/onebot/helper/quick.ts b/src/onebot/helper/quick.ts index 644a5e8e..38957955 100644 --- a/src/onebot/helper/quick.ts +++ b/src/onebot/helper/quick.ts @@ -1,16 +1,26 @@ -import { ChatType, Group, GroupRequestOperateTypes, NapCatCore, Peer } from "@/core"; -import { OB11FriendRequestEvent } from "../event/request/OB11FriendRequest"; -import { OB11GroupRequestEvent } from "../event/request/OB11GroupRequest"; -import { OB11Message, OB11MessageAt, OB11MessageData, OB11MessageReply, QuickAction, QuickActionEvent, QuickActionFriendRequest, QuickActionGroupMessage, QuickActionGroupRequest } from "../types"; -import { isNull } from "@/common/utils/helper"; -import { createSendElements, normalize, sendMsg } from "../action/msg/SendMsg"; +import { ChatType, Group, GroupRequestOperateTypes, NapCatCore, Peer } from '@/core'; +import { OB11FriendRequestEvent } from '../event/request/OB11FriendRequest'; +import { OB11GroupRequestEvent } from '../event/request/OB11GroupRequest'; +import { + OB11Message, + OB11MessageAt, + OB11MessageData, + OB11MessageReply, + QuickAction, + QuickActionEvent, + QuickActionFriendRequest, + QuickActionGroupMessage, + QuickActionGroupRequest, +} from '../types'; +import { isNull } from '@/common/utils/helper'; +import { createSendElements, normalize, sendMsg } from '../action/msg/SendMsg'; async function handleMsg(coreContext: NapCatCore, msg: OB11Message, quickAction: QuickAction) { msg = msg as OB11Message; const reply = quickAction.reply; const peer: Peer = { chatType: ChatType.friend, - peerUid: await coreContext.getApiContext().UserApi.getUidByUin(msg.user_id.toString()) as string + peerUid: await coreContext.getApiContext().UserApi.getUidByUin(msg.user_id.toString()) as string, }; if (msg.message_type == 'private') { if (msg.sub_type === 'group') { @@ -29,15 +39,15 @@ async function handleMsg(coreContext: NapCatCore, msg: OB11Message, quickAction: replyMessage.push({ type: 'reply', data: { - id: msg.message_id.toString() - } + id: msg.message_id.toString(), + }, } as OB11MessageReply); if ((quickAction as QuickActionGroupMessage).at_sender) { replyMessage.push({ type: 'at', data: { - qq: msg.user_id.toString() - } + qq: msg.user_id.toString(), + }, } as OB11MessageAt); } } @@ -46,6 +56,7 @@ async function handleMsg(coreContext: NapCatCore, msg: OB11Message, quickAction: sendMsg(coreContext, peer, sendElements, deleteAfterSentFiles, false).then().catch(coreContext.context.logger.logError); } } + async function handleGroupRequest(coreContext: NapCatCore, request: OB11GroupRequestEvent, quickAction: QuickActionGroupRequest) { if (!isNull(quickAction.approve)) { coreContext.getApiContext().GroupApi.handleGroupRequest( @@ -55,11 +66,13 @@ async function handleGroupRequest(coreContext: NapCatCore, request: OB11GroupReq ).then().catch(coreContext.context.logger.logError); } } + async function handleFriendRequest(coreContext: NapCatCore, request: OB11FriendRequestEvent, quickAction: QuickActionFriendRequest) { if (!isNull(quickAction.approve)) { coreContext.getApiContext().FriendApi.handleFriendRequest(request.flag, !!quickAction.approve).then().catch(coreContext.context.logger.logError); } } + export async function handleQuickOperation(coreContext: NapCatCore, context: QuickActionEvent, quickAction: QuickAction) { if (context.post_type === 'message') { handleMsg(coreContext, context as OB11Message, quickAction).then().catch(coreContext.context.logger.logError); @@ -69,9 +82,8 @@ export async function handleQuickOperation(coreContext: NapCatCore, context: Qui const groupRequest = context as OB11GroupRequestEvent; if ((friendRequest).request_type === 'friend') { handleFriendRequest(coreContext, friendRequest, quickAction).then().catch(coreContext.context.logger.logError); - } - else if (groupRequest.request_type === 'group') { + } else if (groupRequest.request_type === 'group') { handleGroupRequest(coreContext, groupRequest, quickAction).then().catch(coreContext.context.logger.logError); } } -} \ No newline at end of file +} diff --git a/src/onebot/main.ts b/src/onebot/main.ts index d361e8e6..4266f120 100644 --- a/src/onebot/main.ts +++ b/src/onebot/main.ts @@ -1,8 +1,8 @@ -import { NapCatCore, InstanceContext } from "@/core"; -import { OB11Config } from "./helper/config"; -import { NapCatPathWrapper } from "@/common/framework/napcat"; -import { OneBotApiContextType } from "./types/adapter"; -import { OneBotFriendApi, OneBotGroupApi, OneBotUserApi } from "./api"; +import { InstanceContext, NapCatCore } from '@/core'; +import { OB11Config } from './helper/config'; +import { NapCatPathWrapper } from '@/common/framework/napcat'; +import { OneBotApiContextType } from './types/adapter'; +import { OneBotFriendApi, OneBotGroupApi, OneBotUserApi } from './api'; //OneBot实现类 export class NapCatOneBot11Adapter { @@ -10,6 +10,7 @@ export class NapCatOneBot11Adapter { readonly context: InstanceContext; config: OB11Config; apiContext: OneBotApiContextType; + constructor(core: NapCatCore, context: InstanceContext, pathWrapper: NapCatPathWrapper) { this.core = core; this.context = context; @@ -17,7 +18,7 @@ export class NapCatOneBot11Adapter { this.apiContext = { GroupApi: new OneBotGroupApi(this, core), UserApi: new OneBotUserApi(this, core), - FriendApi: new OneBotFriendApi(this, core) + FriendApi: new OneBotFriendApi(this, core), }; } } diff --git a/src/onebot/network/active-http.ts b/src/onebot/network/active-http.ts index 08def382..6ba1a659 100644 --- a/src/onebot/network/active-http.ts +++ b/src/onebot/network/active-http.ts @@ -36,7 +36,7 @@ export class OB11ActiveHttpAdapter implements IOB11NetworkAdapter { onEvent(event: T) { const headers: Record = { 'Content-Type': 'application/json', - 'x-self-id': this.coreContext.selfInfo.uin + 'x-self-id': this.coreContext.selfInfo.uin, }; const msgStr = JSON.stringify(event); if (this.secret && this.secret.length > 0) { @@ -48,7 +48,7 @@ export class OB11ActiveHttpAdapter implements IOB11NetworkAdapter { fetch(this.url, { method: 'POST', headers, - body: msgStr + body: msgStr, }).then(async (res) => { let resJson: QuickAction; try { diff --git a/src/onebot/network/index.ts b/src/onebot/network/index.ts index baa92dfc..f357dab2 100644 --- a/src/onebot/network/index.ts +++ b/src/onebot/network/index.ts @@ -3,33 +3,42 @@ import { OB11BaseEvent } from '@/onebot/event/OB11BaseEvent'; export interface IOB11NetworkAdapter { registerAction, P, R>(action: T): void; + onEvent(event: T): void; + open(): void | Promise; + close(): void | Promise; } + export class OB11NetworkManager { adapters: IOB11NetworkAdapter[] = []; async getAllAdapters() { return this.adapters; } + async PostEvent(event: OB11BaseEvent) { // Mlikiowa V2.0.0 Refactor Todo return Promise.all(this.adapters.map(adapter => adapter.onEvent(event))); } + async registerAdapter(adapter: IOB11NetworkAdapter) { return this.adapters.push(adapter); } + async closeSomeAdapters(adapters: IOB11NetworkAdapter[]) { this.adapters = this.adapters.filter(adapter => !adapters.includes(adapter)); await Promise.all(adapters.map(adapter => adapter.close())); } + async closeAllAdapters() { this.adapters = []; await Promise.all(this.adapters.map(adapter => adapter.close())); } } + export * from './active-http'; export * from './active-websocket'; export * from './passive-http'; -export * from './passive-websocket'; \ No newline at end of file +export * from './passive-websocket'; diff --git a/src/onebot/network/passive-http.ts b/src/onebot/network/passive-http.ts index 387984fc..2938e3ff 100644 --- a/src/onebot/network/passive-http.ts +++ b/src/onebot/network/passive-http.ts @@ -13,7 +13,7 @@ export class OB11PassiveHttpAdapter implements IOB11NetworkAdapter { private port: number; token: string; - constructor(port: number,token: string) { + constructor(port: number, token: string) { this.port = port; this.token = token; } @@ -21,9 +21,11 @@ export class OB11PassiveHttpAdapter implements IOB11NetworkAdapter { registerAction, P, R>(action: T) { this.actionMap.set(action.actionName, action); } + registerHeartBeat() { //空心跳 } + onEvent(event: T) { // 事件处理逻辑可以在这里实现 } @@ -76,4 +78,4 @@ export class OB11PassiveHttpAdapter implements IOB11NetworkAdapter { this.hasBeenClosed = true; this.server?.close(); } -} \ No newline at end of file +} diff --git a/src/onebot/network/passive-websocket.ts b/src/onebot/network/passive-websocket.ts index be96aced..85ae4ee5 100644 --- a/src/onebot/network/passive-websocket.ts +++ b/src/onebot/network/passive-websocket.ts @@ -10,7 +10,7 @@ export class OB11PassiveWebSocketAdapter implements IOB11NetworkAdapter { wsClientsMutex = new Mutex(); isOpen: boolean = false; hasBeenClosed: boolean = false; - heartbeatInterval:number = 0; + heartbeatInterval: number = 0; private actionMap: Map> = new Map(); constructor(ip: string, port: number, heartbeatInterval: number, token: string) { @@ -49,9 +49,11 @@ export class OB11PassiveWebSocketAdapter implements IOB11NetworkAdapter { registerAction, P, R>(action: T) { this.actionMap.set(action.actionName, action); } + registerHeartBeat() { //WS正向心跳 } + onEvent(event: T) { this.wsClientsMutex.runExclusive(async () => { this.wsClients.forEach((wsClient) => { diff --git a/src/onebot/types/adapter.ts b/src/onebot/types/adapter.ts index 3659ad07..d4348228 100644 --- a/src/onebot/types/adapter.ts +++ b/src/onebot/types/adapter.ts @@ -1,7 +1,7 @@ -import { OneBotFriendApi, OneBotGroupApi, OneBotUserApi } from "../api"; +import { OneBotFriendApi, OneBotGroupApi, OneBotUserApi } from '../api'; export interface OneBotApiContextType { FriendApi: OneBotFriendApi; UserApi: OneBotUserApi; GroupApi: OneBotGroupApi; -} \ No newline at end of file +} diff --git a/src/onebot/types/entity.ts b/src/onebot/types/entity.ts index d17eab8b..99a99290 100644 --- a/src/onebot/types/entity.ts +++ b/src/onebot/types/entity.ts @@ -1,65 +1,65 @@ export interface OB11User { - user_id: number; - nickname: string; - remark?: string; - sex?: OB11UserSex; - level?: number; - age?: number; - qid?: string; - login_days?: number; - categroyName?:string; - categoryId?:number; + user_id: number; + nickname: string; + remark?: string; + sex?: OB11UserSex; + level?: number; + age?: number; + qid?: string; + login_days?: number; + categroyName?: string; + categoryId?: number; } export enum OB11UserSex { - male = 'male', - female = 'female', - unknown = 'unknown' + male = 'male', + female = 'female', + unknown = 'unknown' } export enum OB11GroupMemberRole { - owner = 'owner', - admin = 'admin', - member = 'member', + owner = 'owner', + admin = 'admin', + member = 'member', } export interface OB11GroupMember { - group_id: number - user_id: number - nickname: string - card?: string - sex?: OB11UserSex - age?: number - join_time?: number - last_sent_time?: number - level?: string - qq_level?: number - role?: OB11GroupMemberRole - title?: string - area?: string - unfriendly?: boolean - title_expire_time?: number - card_changeable?: boolean - // 以下为gocq字段 - shut_up_timestamp?: number - // 以下为扩展字段 - is_robot?: boolean - qage?: number + group_id: number; + user_id: number; + nickname: string; + card?: string; + sex?: OB11UserSex; + age?: number; + join_time?: number; + last_sent_time?: number; + level?: string; + qq_level?: number; + role?: OB11GroupMemberRole; + title?: string; + area?: string; + unfriendly?: boolean; + title_expire_time?: number; + card_changeable?: boolean; + // 以下为gocq字段 + shut_up_timestamp?: number; + // 以下为扩展字段 + is_robot?: boolean; + qage?: number; } export interface OB11Group { - group_id: number - group_name: string - member_count?: number - max_member_count?: number + group_id: number; + group_name: string; + member_count?: number; + max_member_count?: number; } export interface OB11Sender { - user_id: number, - nickname: string, - sex?: OB11UserSex, - age?: number, - card?: string, // 群名片 - level?: string, // 群等级 - role?: OB11GroupMemberRole + user_id: number, + nickname: string, + sex?: OB11UserSex, + age?: number, + card?: string, // 群名片 + level?: string, // 群等级 + role?: OB11GroupMemberRole } diff --git a/src/onebot/types/message.ts b/src/onebot/types/message.ts index 84eb425f..e9a06612 100644 --- a/src/onebot/types/message.ts +++ b/src/onebot/types/message.ts @@ -3,202 +3,204 @@ import { EventType } from '@/onebot/event/OB11BaseEvent'; import { CustomMusicSignPostData, IdMusicSignPostData, PicSubType, RawMessage } from '@/core'; export enum OB11MessageType { - private = 'private', - group = 'group' + private = 'private', + group = 'group' } export interface OB11Message { - target_id?: number; // 自己发送的消息才有此字段 - self_id?: number, - time: number, - message_id: number, - message_seq: number, // 和message_id一样 - real_id: number, - user_id: number, - group_id?: number, - message_type: 'private' | 'group', - sub_type?: 'friend' | 'group' | 'normal', - sender: OB11Sender, - message: OB11MessageData[] | string, - message_format: 'array' | 'string', - raw_message: string, - font: number, - post_type?: EventType, - raw?: RawMessage + target_id?: number; // 自己发送的消息才有此字段 + self_id?: number, + time: number, + message_id: number, + message_seq: number, // 和message_id一样 + real_id: number, + user_id: number, + group_id?: number, + message_type: 'private' | 'group', + sub_type?: 'friend' | 'group' | 'normal', + sender: OB11Sender, + message: OB11MessageData[] | string, + message_format: 'array' | 'string', + raw_message: string, + font: number, + post_type?: EventType, + raw?: RawMessage } export interface OB11ForwardMessage extends OB11Message { - content: OB11MessageData[] | string; + content: OB11MessageData[] | string; } export interface OB11Return { - status: string - retcode: number - data: DataType - message: string, - echo?: any, // ws调用api才有此字段 - wording?: string, // go-cqhttp字段,错误信息 + status: string + retcode: number + data: DataType + message: string, + echo?: any, // ws调用api才有此字段 + wording?: string, // go-cqhttp字段,错误信息 } export enum OB11MessageDataType { - text = 'text', - image = 'image', - music = 'music', - video = 'video', - voice = 'record', - file = 'file', - at = 'at', - reply = 'reply', - json = 'json', - face = 'face', - mface = 'mface', // 商城表情 - markdown = 'markdown', - node = 'node', // 合并转发消息节点 - forward = 'forward', // 合并转发消息,用于上报 - xml = 'xml', - poke = 'poke', - dice = 'dice', - RPS = 'rps', - miniapp = 'miniapp',//json类 - Location = 'location' + text = 'text', + image = 'image', + music = 'music', + video = 'video', + voice = 'record', + file = 'file', + at = 'at', + reply = 'reply', + json = 'json', + face = 'face', + mface = 'mface', // 商城表情 + markdown = 'markdown', + node = 'node', // 合并转发消息节点 + forward = 'forward', // 合并转发消息,用于上报 + xml = 'xml', + poke = 'poke', + dice = 'dice', + RPS = 'rps', + miniapp = 'miniapp',//json类 + Location = 'location' } export interface OB11MessageMFace { - type: OB11MessageDataType.mface - data: { - emoji_package_id: number - emoji_id: string - key: string - summary: string - } + type: OB11MessageDataType.mface; + data: { + emoji_package_id: number + emoji_id: string + key: string + summary: string + }; } export interface OB11MessageText { - type: OB11MessageDataType.text, - data: { - text: string, // 纯文本 - } + type: OB11MessageDataType.text, + data: { + text: string, // 纯文本 + } } export interface OB11MessageFileBase { - data: { - thumb?: string; - name?: string; - file: string, - url?: string; - } + data: { + thumb?: string; + name?: string; + file: string, + url?: string; + }; } export interface OB11MessageImage extends OB11MessageFileBase { - type: OB11MessageDataType.image - data: OB11MessageFileBase['data'] & { - summary?: string; // 图片摘要 - subType?: PicSubType - }, + type: OB11MessageDataType.image + data: OB11MessageFileBase['data'] & { + summary?: string; // 图片摘要 + subType?: PicSubType + }, } export interface OB11MessageRecord extends OB11MessageFileBase { - type: OB11MessageDataType.voice + type: OB11MessageDataType.voice; } export interface OB11MessageFile extends OB11MessageFileBase { - type: OB11MessageDataType.file + type: OB11MessageDataType.file; } export interface OB11MessageVideo extends OB11MessageFileBase { - type: OB11MessageDataType.video + type: OB11MessageDataType.video; } export interface OB11MessageAt { - type: OB11MessageDataType.at - data: { - qq: `${number}` | 'all' - name?: string - } + type: OB11MessageDataType.at; + data: { + qq: `${number}` | 'all' + name?: string + }; } export interface OB11MessageReply { - type: OB11MessageDataType.reply - data: { - id: string - } + type: OB11MessageDataType.reply; + data: { + id: string + }; } export interface OB11MessageFace { - type: OB11MessageDataType.face - data: { - id: string - } + type: OB11MessageDataType.face; + data: { + id: string + }; } export type OB11MessageMixType = OB11MessageData[] | string | OB11MessageData; export interface OB11MessageNode { - type: OB11MessageDataType.node - data: { - id?: string - user_id?: number - nickname: string - content: OB11MessageMixType - } + type: OB11MessageDataType.node; + data: { + id?: string + user_id?: number + nickname: string + content: OB11MessageMixType + }; } export interface OB11MessageIdMusic { - type: OB11MessageDataType.music - data: IdMusicSignPostData + type: OB11MessageDataType.music; + data: IdMusicSignPostData; } + export interface OB11MessageCustomMusic { - type: OB11MessageDataType.music - data: Omit & { content?: string } + type: OB11MessageDataType.music; + data: Omit & { content?: string }; } export interface OB11MessageJson { - type: OB11MessageDataType.json - data: { config: { token: string } } & any + type: OB11MessageDataType.json; + data: { config: { token: string } } & any; } export interface OB11MessageDice { - type: OB11MessageDataType.dice, - data: { - result: number - } + type: OB11MessageDataType.dice, + data: { + result: number + } } + export interface OB11MessageRPS { - type: OB11MessageDataType.RPS, - data: { - result: number - } + type: OB11MessageDataType.RPS, + data: { + result: number + } } export interface OB11MessageMarkdown { - type: OB11MessageDataType.markdown - data: { - content: string - } + type: OB11MessageDataType.markdown; + data: { + content: string + }; } export interface OB11MessageForward { - type: OB11MessageDataType.forward - data: { - id: string, - content: OB11Message[] - } + type: OB11MessageDataType.forward; + data: { + id: string, + content: OB11Message[] + }; } export type OB11MessageData = - OB11MessageText | - OB11MessageFace | OB11MessageMFace | - OB11MessageAt | OB11MessageReply | - OB11MessageImage | OB11MessageRecord | OB11MessageFile | OB11MessageVideo | - OB11MessageNode | OB11MessageIdMusic | OB11MessageCustomMusic | OB11MessageJson | - OB11MessageDice | OB11MessageRPS | OB11MessageMarkdown | OB11MessageForward + OB11MessageText | + OB11MessageFace | OB11MessageMFace | + OB11MessageAt | OB11MessageReply | + OB11MessageImage | OB11MessageRecord | OB11MessageFile | OB11MessageVideo | + OB11MessageNode | OB11MessageIdMusic | OB11MessageCustomMusic | OB11MessageJson | + OB11MessageDice | OB11MessageRPS | OB11MessageMarkdown | OB11MessageForward export interface OB11PostSendMsg { - message_type?: 'private' | 'group' - user_id?: string, - group_id?: string, - message: OB11MessageMixType; - messages?: OB11MessageMixType; // 兼容 go-cqhttp - auto_escape?: boolean | string + message_type?: 'private' | 'group' + user_id?: string, + group_id?: string, + message: OB11MessageMixType; + messages?: OB11MessageMixType; // 兼容 go-cqhttp + auto_escape?: boolean | string } diff --git a/src/onebot/types/quick.ts b/src/onebot/types/quick.ts index 2dd3e8a5..748c8705 100644 --- a/src/onebot/types/quick.ts +++ b/src/onebot/types/quick.ts @@ -1,37 +1,37 @@ -import { OB11BaseMetaEvent } from "../event/meta/OB11BaseMetaEvent"; -import { OB11BaseNoticeEvent } from "../event/notice/OB11BaseNoticeEvent"; -import { OB11Message } from "./message"; +import { OB11BaseMetaEvent } from '../event/meta/OB11BaseMetaEvent'; +import { OB11BaseNoticeEvent } from '../event/notice/OB11BaseNoticeEvent'; +import { OB11Message } from './message'; export type QuickActionEvent = OB11Message | OB11BaseMetaEvent | OB11BaseNoticeEvent export type PostEventType = OB11Message | OB11BaseMetaEvent | OB11BaseNoticeEvent export interface QuickActionPrivateMessage { - reply?: string; - auto_escape?: boolean; + reply?: string; + auto_escape?: boolean; } export interface QuickActionGroupMessage extends QuickActionPrivateMessage { - // 回复群消息 - at_sender?: boolean; - delete?: boolean; - kick?: boolean; - ban?: boolean; - ban_duration?: number; - // + // 回复群消息 + at_sender?: boolean; + delete?: boolean; + kick?: boolean; + ban?: boolean; + ban_duration?: number; + // } export interface QuickActionFriendRequest { - approve?: boolean; - remark?: string; + approve?: boolean; + remark?: string; } export interface QuickActionGroupRequest { - approve?: boolean; - reason?: string; + approve?: boolean; + reason?: string; } export type QuickAction = - QuickActionPrivateMessage - & QuickActionGroupMessage - & QuickActionFriendRequest - & QuickActionGroupRequest + QuickActionPrivateMessage + & QuickActionGroupMessage + & QuickActionFriendRequest + & QuickActionGroupRequest diff --git a/src/shell/napcat.ts b/src/shell/napcat.ts index b8405b78..9bbdc884 100644 --- a/src/shell/napcat.ts +++ b/src/shell/napcat.ts @@ -5,12 +5,12 @@ import { LoginListener, SessionListener } from '@/core/listeners'; import { DependsAdapter, DispatcherAdapter, GlobalAdapter } from '@/core/adapters'; import { NapCatPathWrapper } from '@/common/framework/napcat'; import { - NapCatCoreWorkingEnv, + InstanceContext, loadQQWrapper, NapCatCore, - InstanceContext, - WrapperNodeApi, + NapCatCoreWorkingEnv, NodeIQQNTWrapperSession, + WrapperNodeApi, } from '@/core'; import { QQBasicInfoWrapper } from '@/common/utils/QQBasicInfo'; import { hostname, systemVersion } from '@/common/utils/system'; @@ -209,7 +209,7 @@ export class NapCatShell { loginService: NodeIKernelLoginService, selfInfo: SelfInfo, basicInfoWrapper: QQBasicInfoWrapper, - pathWrapper: NapCatPathWrapper + pathWrapper: NapCatPathWrapper, ) { this.context = { workingEnv: NapCatCoreWorkingEnv.Shell, @@ -218,7 +218,7 @@ export class NapCatShell { logger, loginService, basicInfoWrapper, - pathWrapper + pathWrapper, }; this.core = new NapCatCore(this.context, selfInfo); diff --git a/src/webui/Readme.md b/src/webui/Readme.md index c79d50bd..512eac30 100644 --- a/src/webui/Readme.md +++ b/src/webui/Readme.md @@ -1,2 +1,3 @@ # The Path of NapCatQQ -Tiny WebUi for NapCatQQ \ No newline at end of file + +Tiny WebUi for NapCatQQ diff --git a/src/webui/index.ts b/src/webui/index.ts index c05fddcd..4bc6ad5d 100644 --- a/src/webui/index.ts +++ b/src/webui/index.ts @@ -1,14 +1,12 @@ import express from 'express'; -import { NextFunction, Request, Response } from 'express'; -import { AuthHelper } from './src/helper/SignToken'; -import { resolve } from 'node:path'; +import { dirname, resolve } from 'node:path'; import { ALLRouter } from './src/router'; import { WebUiConfig } from './src/helper/config'; -const app = express(); -import { dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; import { log } from '@/common/utils/log'; +const app = express(); + const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); diff --git a/src/webui/src/api/Auth.ts b/src/webui/src/api/Auth.ts index 519d47c0..5f9dbe30 100644 --- a/src/webui/src/api/Auth.ts +++ b/src/webui/src/api/Auth.ts @@ -2,6 +2,7 @@ import { RequestHandler } from 'express'; import { AuthHelper } from '../helper/SignToken'; import { WebUiConfig } from '../helper/config'; import { WebUiDataRuntime } from '../helper/Data'; + const isEmpty = (data: any) => data === undefined || data === null || data === ''; export const LoginHandler: RequestHandler = async (req, res) => { const WebUiConfigData = await WebUiConfig.GetWebUIConfig(); @@ -9,14 +10,14 @@ export const LoginHandler: RequestHandler = async (req, res) => { if (isEmpty(token)) { res.json({ code: -1, - message: 'token is empty' + message: 'token is empty', }); return; - } + } if (!await WebUiDataRuntime.checkLoginRate(WebUiConfigData.loginRate)) { res.json({ code: -1, - message: 'login rate limit' + message: 'login rate limit', }); return; } @@ -24,7 +25,7 @@ export const LoginHandler: RequestHandler = async (req, res) => { if (WebUiConfigData.token !== token) { res.json({ code: -1, - message: 'token is invalid' + message: 'token is invalid', }); return; } @@ -33,8 +34,8 @@ export const LoginHandler: RequestHandler = async (req, res) => { code: 0, message: 'success', data: { - 'Credential': signCredential - } + 'Credential': signCredential, + }, }); return; }; @@ -42,7 +43,7 @@ export const LogoutHandler: RequestHandler = (req, res) => { // 这玩意无状态销毁个灯 得想想办法 res.json({ code: 0, - message: 'success' + message: 'success', }); return; }; @@ -50,18 +51,18 @@ export const checkHandler: RequestHandler = async (req, res) => { const WebUiConfigData = await WebUiConfig.GetWebUIConfig(); const authorization = req.headers.authorization; try { - const CredentialBase64:string = authorization?.split(' ')[1] as string; + const CredentialBase64: string = authorization?.split(' ')[1] as string; const Credential = JSON.parse(Buffer.from(CredentialBase64, 'base64').toString()); - await AuthHelper.validateCredentialWithinOneHour(WebUiConfigData.token,Credential); + await AuthHelper.validateCredentialWithinOneHour(WebUiConfigData.token, Credential); res.json({ code: 0, - message: 'success' + message: 'success', }); return; } catch (e) { res.json({ code: -1, - message: 'failed' + message: 'failed', }); } return; diff --git a/src/webui/src/api/LogConsole.ts b/src/webui/src/api/LogConsole.ts index 8d45e23a..2ca960d1 100644 --- a/src/webui/src/api/LogConsole.ts +++ b/src/webui/src/api/LogConsole.ts @@ -14,7 +14,7 @@ export const GetLogFileListHandler: RequestHandler = async (req, res) => { const LogFiles = await readdir(LogsPath); res.json({ code: 0, - data: LogFiles + data: LogFiles, }); } catch (error) { res.json({ code: -1, msg: 'Failed to retrieve log file list.' }); @@ -51,4 +51,4 @@ export const GetLogFileHandler: RequestHandler = async (req, res) => { // export function isValidFileName(fileName: string): boolean { // const invalidChars = /[\.\:\*\?\"\<\>\|\/\\]/; // return !invalidChars.test(fileName); -// } \ No newline at end of file +// } diff --git a/src/webui/src/api/OB11Config.ts b/src/webui/src/api/OB11Config.ts index f9e07ee3..f4733f45 100644 --- a/src/webui/src/api/OB11Config.ts +++ b/src/webui/src/api/OB11Config.ts @@ -1,9 +1,8 @@ import { RequestHandler } from 'express'; import { WebUiDataRuntime } from '../helper/Data'; -import { existsSync, readFileSync, writeFileSync } from 'node:fs'; -import { resolve } from 'node:path'; +import { existsSync, readFileSync } from 'node:fs'; +import { dirname, resolve } from 'node:path'; import { OB11Config } from '@/webui/ui/components/WebUiApiOB11Config'; -import { dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; @@ -29,7 +28,7 @@ export const OB11GetConfigHandler: RequestHandler = async (req, res) => { data = JSON.parse( existsSync(configFilePath) ? readFileSync(configFilePath).toString() - : readFileSync(resolve(__dirname, './config/onebot11.json')).toString() + : readFileSync(resolve(__dirname, './config/onebot11.json')).toString(), ); } catch (e) { data = {} as OB11Config; diff --git a/src/webui/src/api/QQLogin.ts b/src/webui/src/api/QQLogin.ts index 0ea96df0..c5c7b9ce 100644 --- a/src/webui/src/api/QQLogin.ts +++ b/src/webui/src/api/QQLogin.ts @@ -1,12 +1,12 @@ import { RequestHandler } from 'express'; import { WebUiDataRuntime } from '../helper/Data'; -import { sleep } from '@/common/utils/helper'; + const isEmpty = (data: any) => data === undefined || data === null || data === ''; export const QQGetQRcodeHandler: RequestHandler = async (req, res) => { if (await WebUiDataRuntime.getQQLoginStatus()) { res.send({ code: -1, - message: 'QQ Is Logined' + message: 'QQ Is Logined', }); return; } @@ -14,7 +14,7 @@ export const QQGetQRcodeHandler: RequestHandler = async (req, res) => { if (isEmpty(qrcodeUrl)) { res.send({ code: -1, - message: 'QRCode Get Error' + message: 'QRCode Get Error', }); return; } @@ -22,8 +22,8 @@ export const QQGetQRcodeHandler: RequestHandler = async (req, res) => { code: 0, message: 'success', data: { - qrcode: qrcodeUrl - } + qrcode: qrcodeUrl, + }, }); return; }; @@ -32,8 +32,8 @@ export const QQCheckLoginStatusHandler: RequestHandler = async (req, res) => { code: 0, message: 'success', data: { - isLogin: await WebUiDataRuntime.getQQLoginStatus() - } + isLogin: await WebUiDataRuntime.getQQLoginStatus(), + }, }); }; export const QQSetQuickLoginHandler: RequestHandler = async (req, res) => { @@ -42,14 +42,14 @@ export const QQSetQuickLoginHandler: RequestHandler = async (req, res) => { if (isLogin) { res.send({ code: -1, - message: 'QQ Is Logined' + message: 'QQ Is Logined', }); return; } if (isEmpty(uin)) { res.send({ code: -1, - message: 'uin is empty' + message: 'uin is empty', }); return; } @@ -57,7 +57,7 @@ export const QQSetQuickLoginHandler: RequestHandler = async (req, res) => { if (!result) { res.send({ code: -1, - message: message + message: message, }); return; } @@ -65,13 +65,13 @@ export const QQSetQuickLoginHandler: RequestHandler = async (req, res) => { //isLogin = await WebUiDataRuntime.getQQLoginStatus(); res.send({ code: 0, - message: 'success' + message: 'success', }); }; export const QQGetQuickLoginListHandler: RequestHandler = async (req, res) => { const quickLoginList = await WebUiDataRuntime.getQQQuickLoginList(); res.send({ code: 0, - data: quickLoginList + data: quickLoginList, }); -}; \ No newline at end of file +}; diff --git a/src/webui/src/helper/Data.ts b/src/webui/src/helper/Data.ts index e944ac4d..10594175 100644 --- a/src/webui/src/helper/Data.ts +++ b/src/webui/src/helper/Data.ts @@ -10,8 +10,9 @@ interface LoginRuntimeType { CoreQuickLoginCall: (uin: string) => Promise<{ result: boolean, message: string }>; SetOb11ConfigCall: (ob11: OB11Config) => Promise; QQLoginList: string[] - } + }; } + const LoginRuntime: LoginRuntimeType = { LoginCurrentTime: Date.now(), LoginCurrentRate: 0, @@ -19,13 +20,17 @@ const LoginRuntime: LoginRuntimeType = { QQQRCodeURL: '', QQLoginUin: '', NapCatHelper: { - SetOb11ConfigCall: async (ob11: OB11Config) => { return; }, - CoreQuickLoginCall: async (uin: string) => { return { result: false, message: '' }; }, - QQLoginList: [] - } + SetOb11ConfigCall: async (ob11: OB11Config) => { + return; + }, + CoreQuickLoginCall: async (uin: string) => { + return { result: false, message: '' }; + }, + QQLoginList: [], + }, }; export const WebUiDataRuntime = { - checkLoginRate: async function (RateLimit: number): Promise { + checkLoginRate: async function(RateLimit: number): Promise { LoginRuntime.LoginCurrentRate++; //console.log(RateLimit, LoginRuntime.LoginCurrentRate, Date.now() - LoginRuntime.LoginCurrentTime); if (Date.now() - LoginRuntime.LoginCurrentTime > 1000 * 60) { @@ -39,45 +44,45 @@ export const WebUiDataRuntime = { return false; } , - getQQLoginStatus: async function (): Promise { + getQQLoginStatus: async function(): Promise { return LoginRuntime.QQLoginStatus; } , - setQQLoginStatus: async function (status: boolean): Promise { + setQQLoginStatus: async function(status: boolean): Promise { LoginRuntime.QQLoginStatus = status; } , - setQQLoginQrcodeURL: async function (url: string): Promise { + setQQLoginQrcodeURL: async function(url: string): Promise { LoginRuntime.QQQRCodeURL = url; } , - getQQLoginQrcodeURL: async function (): Promise { + getQQLoginQrcodeURL: async function(): Promise { return LoginRuntime.QQQRCodeURL; } , - setQQLoginUin: async function (uin: string): Promise { + setQQLoginUin: async function(uin: string): Promise { LoginRuntime.QQLoginUin = uin; } , - getQQLoginUin: async function (): Promise { + getQQLoginUin: async function(): Promise { return LoginRuntime.QQLoginUin; }, - getQQQuickLoginList: async function (): Promise { + getQQQuickLoginList: async function(): Promise { return LoginRuntime.NapCatHelper.QQLoginList; }, - setQQQuickLoginList: async function (list: string[]): Promise { + setQQQuickLoginList: async function(list: string[]): Promise { LoginRuntime.NapCatHelper.QQLoginList = list; }, setQQQuickLoginCall(func: (uin: string) => Promise<{ result: boolean, message: string }>): void { LoginRuntime.NapCatHelper.CoreQuickLoginCall = func; }, - getQQQuickLogin: async function (uin: string): Promise<{ result: boolean, message: string }> { + getQQQuickLogin: async function(uin: string): Promise<{ result: boolean, message: string }> { return await LoginRuntime.NapCatHelper.CoreQuickLoginCall(uin); }, - setOB11ConfigCall: async function (func: (ob11: OB11Config) => Promise): Promise { + setOB11ConfigCall: async function(func: (ob11: OB11Config) => Promise): Promise { LoginRuntime.NapCatHelper.SetOb11ConfigCall = func; }, - setOB11Config: async function (ob11: OB11Config): Promise { + setOB11Config: async function(ob11: OB11Config): Promise { await LoginRuntime.NapCatHelper.SetOb11ConfigCall(ob11); - } -}; \ No newline at end of file + }, +}; diff --git a/src/webui/src/helper/SignToken.ts b/src/webui/src/helper/SignToken.ts index 0cce59f9..2932e8dc 100644 --- a/src/webui/src/helper/SignToken.ts +++ b/src/webui/src/helper/SignToken.ts @@ -65,4 +65,4 @@ export class AuthHelper { return timeDifference <= 3600 && credentialJson.Data.TokenEncoded === token; } -} \ No newline at end of file +} diff --git a/src/webui/src/helper/config.ts b/src/webui/src/helper/config.ts index cc13cc18..53ace027 100644 --- a/src/webui/src/helper/config.ts +++ b/src/webui/src/helper/config.ts @@ -1,7 +1,6 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs'; -import { resolve } from 'node:path'; +import { dirname, resolve } from 'node:path'; import * as net from 'node:net'; -import { dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; @@ -73,14 +72,17 @@ export interface WebUiConfigType { port: number; prefix: string; token: string; - loginRate: number + loginRate: number; } + // 读取当前目录下名为 webui.json 的配置文件,如果不存在则创建初始化配置文件 class WebUiConfigWrapper { WebUiConfigData: WebUiConfigType | undefined = undefined; + private applyDefaults(obj: Partial, defaults: T): T { return { ...defaults, ...obj }; } + async GetWebUIConfig(): Promise { if (this.WebUiConfigData) { return this.WebUiConfigData; @@ -90,7 +92,7 @@ class WebUiConfigWrapper { port: 6099, prefix: '', token: '', // 默认先填空,空密码无法登录 - loginRate: 3 + loginRate: 3, }; try { defaultconfig.token = Math.random().toString(36).slice(2); //生成随机密码 @@ -138,4 +140,5 @@ class WebUiConfigWrapper { return defaultconfig; // 理论上这行代码到不了,到了只能返回默认配置了 } } + export const WebUiConfig = new WebUiConfigWrapper(); diff --git a/src/webui/src/router/OB11Config.ts b/src/webui/src/router/OB11Config.ts index c9fae805..75eee681 100644 --- a/src/webui/src/router/OB11Config.ts +++ b/src/webui/src/router/OB11Config.ts @@ -1,6 +1,7 @@ import { Router } from 'express'; -import { OB11GetConfigHandler,OB11SetConfigHandler } from '../api/OB11Config'; +import { OB11GetConfigHandler, OB11SetConfigHandler } from '../api/OB11Config'; + const router = Router(); router.post('/GetConfig', OB11GetConfigHandler); router.post('/SetConfig', OB11SetConfigHandler); -export { router as OB11ConfigRouter }; \ No newline at end of file +export { router as OB11ConfigRouter }; diff --git a/src/webui/src/router/QQLogin.ts b/src/webui/src/router/QQLogin.ts index 61fccd80..762e5ed1 100644 --- a/src/webui/src/router/QQLogin.ts +++ b/src/webui/src/router/QQLogin.ts @@ -1,8 +1,14 @@ import { Router } from 'express'; -import { QQCheckLoginStatusHandler, QQGetQRcodeHandler, QQGetQuickLoginListHandler, QQSetQuickLoginHandler } from '../api/QQLogin'; +import { + QQCheckLoginStatusHandler, + QQGetQRcodeHandler, + QQGetQuickLoginListHandler, + QQSetQuickLoginHandler, +} from '../api/QQLogin'; + const router = Router(); router.all('/GetQuickLoginList', QQGetQuickLoginListHandler); router.post('/CheckLoginStatus', QQCheckLoginStatusHandler); router.post('/GetQQLoginQrcode', QQGetQRcodeHandler); router.post('/SetQuickLogin', QQSetQuickLoginHandler); -export { router as QQLoginRouter }; \ No newline at end of file +export { router as QQLoginRouter }; diff --git a/src/webui/src/router/auth.ts b/src/webui/src/router/auth.ts index c61367ec..f523ef11 100644 --- a/src/webui/src/router/auth.ts +++ b/src/webui/src/router/auth.ts @@ -1,9 +1,9 @@ import { Router } from 'express'; -import { LoginHandler, LogoutHandler, checkHandler } from '../api/Auth'; +import { checkHandler, LoginHandler, LogoutHandler } from '../api/Auth'; const router = Router(); router.post('/login', LoginHandler); router.post('/check', checkHandler); router.post('/logout', LogoutHandler); -export { router as AuthRouter }; \ No newline at end of file +export { router as AuthRouter }; diff --git a/src/webui/src/router/index.ts b/src/webui/src/router/index.ts index 56c206c9..3c9bd7db 100644 --- a/src/webui/src/router/index.ts +++ b/src/webui/src/router/index.ts @@ -1,11 +1,12 @@ -import { Router } from 'express'; +import { NextFunction, Request, Response, Router } from 'express'; import { AuthHelper } from '../../src/helper/SignToken'; -import { NextFunction, Request, Response } from 'express'; import { QQLoginRouter } from './QQLogin'; import { AuthRouter } from './auth'; import { OB11ConfigRouter } from './OB11Config'; import { WebUiConfig } from '../helper/config'; + const router = Router(); + export async function AuthApi(req: Request, res: Response, next: NextFunction) { //判断当前url是否为/login 如果是跳过鉴权 if (req.url == '/auth/login') { @@ -52,6 +53,7 @@ export async function AuthApi(req: Request, res: Response, next: NextFunction) { }); return; } + router.use(AuthApi); router.all('/test', (req, res) => { res.json({ @@ -62,4 +64,4 @@ router.all('/test', (req, res) => { router.use('/auth', AuthRouter); router.use('/QQLogin', QQLoginRouter); router.use('/OB11Config', OB11ConfigRouter); -export { router as ALLRouter }; \ No newline at end of file +export { router as ALLRouter }; diff --git a/src/webui/ui/NapCat.ts b/src/webui/ui/NapCat.ts index f6544d0e..38beabdc 100644 --- a/src/webui/ui/NapCat.ts +++ b/src/webui/ui/NapCat.ts @@ -4,6 +4,7 @@ import { SettingButton } from './components/SettingButton'; import { SettingSwitch } from './components/SettingSwitch'; import { SettingSelect } from './components/SettingSelect'; import { OB11Config, OB11ConfigWrapper } from './components/WebUiApiOB11Config'; + async function onSettingWindowCreated(view: Element) { const isEmpty = (value: any) => value === undefined || value === undefined || value === ''; await OB11ConfigWrapper.Init(localStorage.getItem('auth') as string); @@ -15,7 +16,7 @@ async function onSettingWindowCreated(view: Element) { } else if (configKey.length === 3) { ob11Config[configKey[1]][configKey[2]] = value; } - // OB11ConfigWrapper.SetOB11Config(ob11Config); // 只有当点保存时才下发配置,而不是在修改值后立即下发 + // OB11ConfigWrapper.SetOB11Config(ob11Config); // 只有当点保存时才下发配置,而不是在修改值后立即下发 }; const parser = new DOMParser(); @@ -29,7 +30,7 @@ async function onSettingWindowCreated(view: Element) { SettingItem( 'Napcat', undefined, - SettingButton('V1.8.3', 'napcat-update-button', 'secondary') + SettingButton('V1.8.3', 'napcat-update-button', 'secondary'), ), ]), SettingList([ @@ -38,28 +39,28 @@ async function onSettingWindowCreated(view: Element) { undefined, SettingSwitch('ob11.http.enable', ob11Config.http.enable, { 'control-display-id': 'config-ob11-http-port', - }) + }), ), SettingItem( 'HTTP 服务监听端口', undefined, `
`, 'config-ob11-http-port', - ob11Config.http.enable + ob11Config.http.enable, ), SettingItem( '启用 HTTP 心跳', undefined, SettingSwitch('ob11.http.enableHeart', ob11Config.http.enableHeart, { 'control-display-id': 'config-ob11-HTTP.enableHeart', - }) + }), ), SettingItem( '启用 HTTP 事件上报', undefined, SettingSwitch('ob11.http.enablePost', ob11Config.http.enablePost, { 'control-display-id': 'config-ob11-http-postUrls', - }) + }), ), `
@@ -85,21 +86,21 @@ async function onSettingWindowCreated(view: Element) { undefined, SettingSwitch('ob11.ws.enable', ob11Config.ws.enable, { 'control-display-id': 'config-ob11-ws-port', - }) + }), ), SettingItem( '正向 WebSocket 服务监听端口', undefined, `
`, 'config-ob11-ws-port', - ob11Config.ws.enable + ob11Config.ws.enable, ), SettingItem( '启用反向 WebSocket 服务', undefined, SettingSwitch('ob11.reverseWs.enable', ob11Config.reverseWs.enable, { 'control-display-id': 'config-ob11-reverseWs-urls', - }) + }), ), `
@@ -113,12 +114,12 @@ async function onSettingWindowCreated(view: Element) { SettingItem( ' WebSocket 服务心跳间隔', '控制每隔多久发送一个心跳包,单位为毫秒', - `
` + `
`, ), SettingItem( 'Access token', undefined, - `
` + `
`, ), SettingItem( '新消息上报格式', @@ -129,21 +130,21 @@ async function onSettingWindowCreated(view: Element) { { text: 'CQ码', value: 'string' }, ], 'ob11.messagePostFormat', - ob11Config.messagePostFormat - ) + ob11Config.messagePostFormat, + ), ), SettingItem( '音乐卡片签名地址', undefined, `
`, - 'ob11.musicSignUrl' + 'ob11.musicSignUrl', ), SettingItem( '启用本地进群时间与发言时间记录', undefined, SettingSwitch('ob11.GroupLocalTime.Record', ob11Config.GroupLocalTime.Record, { 'control-display-id': 'config-ob11-GroupLocalTime-RecordList', - }) + }), ), `
@@ -157,37 +158,37 @@ async function onSettingWindowCreated(view: Element) { SettingItem( '', undefined, - SettingButton('保存', 'config-ob11-save', 'primary') + SettingButton('保存', 'config-ob11-save', 'primary'), ), ]), SettingList([ SettingItem( '上报 Bot 自身发送的消息', '上报 event 为 message_sent', - SettingSwitch('ob11.reportSelfMessage', ob11Config.reportSelfMessage) + SettingSwitch('ob11.reportSelfMessage', ob11Config.reportSelfMessage), ), ]), SettingList([ SettingItem( 'GitHub 仓库', 'https://github.com/NapNeko/NapCatQQ', - SettingButton('点个星星', 'open-github') + SettingButton('点个星星', 'open-github'), ), SettingItem('NapCat 文档', '', SettingButton('看看文档', 'open-docs')), SettingItem( 'Telegram 群', 'https://t.me/+nLZEnpne-pQ1OWFl', - SettingButton('进去逛逛', 'open-telegram') + SettingButton('进去逛逛', 'open-telegram'), ), SettingItem( 'QQ 群', '545402644', - SettingButton('我要进去', 'open-qq-group') + SettingButton('我要进去', 'open-qq-group'), ), ]), '
', ].join(''), - 'text/html' + 'text/html', ); // 外链按钮 @@ -208,7 +209,7 @@ async function onSettingWindowCreated(view: Element) { type: string, host: string, index: number, - inputAttrs: any = {} + inputAttrs: any = {}, ) => { const dom = { container: document.createElement('setting-item'), @@ -224,7 +225,7 @@ async function onSettingWindowCreated(view: Element) { dom.input.value = host; dom.input.addEventListener('input', () => { ob11Config[type.split('-')[0]][type.split('-')[1]][index] = - dom.input.value; + dom.input.value; }); dom.inputContainer.classList.add('q-input'); @@ -245,7 +246,7 @@ async function onSettingWindowCreated(view: Element) { const buildHostList = ( hosts: string[], type: string, - inputAttr: any = {} + inputAttr: any = {}, ) => { const result: HTMLElement[] = []; @@ -258,32 +259,32 @@ async function onSettingWindowCreated(view: Element) { const addReverseHost = ( type: string, doc: Document = document, - inputAttr: any = {} + inputAttr: any = {}, ) => { type = type.replace(/\./g, '-');//替换操作 const hostContainerDom = doc.body.querySelector( - `#config-ob11-${type}-list` + `#config-ob11-${type}-list`, ); hostContainerDom?.appendChild( buildHostListItem( type, '', ob11Config[type.split('-')[0]][type.split('-')[1]].length, - inputAttr - ) + inputAttr, + ), ); ob11Config[type.split('-')[0]][type.split('-')[1]].push(''); }; const initReverseHost = (type: string, doc: Document = document) => { type = type.replace(/\./g, '-');//替换操作 const hostContainerDom = doc.body?.querySelector( - `#config-ob11-${type}-list` + `#config-ob11-${type}-list`, ); if (hostContainerDom) { [...hostContainerDom.childNodes].forEach((dom) => dom.remove()); buildHostList( ob11Config[type.split('-')[0]][type.split('-')[1]], - type + type, ).forEach((dom) => { hostContainerDom?.appendChild(dom); }); @@ -299,7 +300,7 @@ async function onSettingWindowCreated(view: Element) { ?.addEventListener('click', () => addReverseHost('http.postUrls', document, { placeholder: '如:http://127.0.0.1:5140/onebot', - }) + }), ); doc @@ -307,21 +308,21 @@ async function onSettingWindowCreated(view: Element) { ?.addEventListener('click', () => addReverseHost('reverseWs.urls', document, { placeholder: '如:ws://127.0.0.1:5140/onebot', - }) + }), ); doc .querySelector('#config-ob11-GroupLocalTime-RecordList-add') ?.addEventListener('click', () => addReverseHost('GroupLocalTime.RecordList', document, { placeholder: '此处填写群号 -1为全部', - }) + }), ); doc.querySelector('#config-ffmpeg-select')?.addEventListener('click', () => { - //选择ffmpeg + //选择ffmpeg }); doc.querySelector('#config-open-log-path')?.addEventListener('click', () => { - //打开日志 + //打开日志 }); // 开关 @@ -338,7 +339,7 @@ async function onSettingWindowCreated(view: Element) { if (!isEmpty(dom.dataset.controlDisplayId)) { const displayDom = document.querySelector( //@ts-expect-error 等待修复 - `#${dom.dataset.controlDisplayId}` + `#${dom.dataset.controlDisplayId}`, ); if (active) displayDom?.removeAttribute('is-hidden'); else displayDom?.setAttribute('is-hidden', ''); @@ -349,7 +350,7 @@ async function onSettingWindowCreated(view: Element) { // 输入框 doc .querySelectorAll( - 'setting-item .q-input input.q-input__inner[data-config-key]' + 'setting-item .q-input input.q-input__inner[data-config-key]', ) .forEach((dom: Element) => { dom.addEventListener('input', () => { @@ -357,11 +358,11 @@ async function onSettingWindowCreated(view: Element) { //@ts-expect-error等待修复 const configKey = dom.dataset.configKey; const configValue = - Type === 'number' - ? parseInt((dom as HTMLInputElement).value) >= 1 - ? parseInt((dom as HTMLInputElement).value) - : 1 - : (dom as HTMLInputElement).value; + Type === 'number' + ? parseInt((dom as HTMLInputElement).value) >= 1 + ? parseInt((dom as HTMLInputElement).value) + : 1 + : (dom as HTMLInputElement).value; setOB11Config(configKey, configValue); }); @@ -389,4 +390,5 @@ async function onSettingWindowCreated(view: Element) { view.appendChild(node); }); } + export { onSettingWindowCreated }; diff --git a/src/webui/ui/components/SettingSelect.ts b/src/webui/ui/components/SettingSelect.ts index 161186b0..83aaa9b0 100644 --- a/src/webui/ui/components/SettingSelect.ts +++ b/src/webui/ui/components/SettingSelect.ts @@ -1,7 +1,7 @@ import { SettingOption } from './SettingOption'; interface MouseEventExtend extends MouseEvent { - target: HTMLElement + target: HTMLElement; } // @@ -81,4 +81,4 @@ export const SettingSelect = (items: Array<{ text: string; value: string }>, con }) .join('')} `; -}; \ No newline at end of file +}; diff --git a/src/webui/ui/components/WebUiApiOB11Config.ts b/src/webui/ui/components/WebUiApiOB11Config.ts index 200cbb03..2d510ecd 100644 --- a/src/webui/ui/components/WebUiApiOB11Config.ts +++ b/src/webui/ui/components/WebUiApiOB11Config.ts @@ -1,42 +1,45 @@ export interface OB11Config { - [key: string]: any; - http: { - enable: boolean; - host: ''; - port: number; - secret: ''; - enableHeart: boolean; - enablePost: boolean; - postUrls: string[]; - }; - ws: { - enable: boolean; - host: ''; - port: number; - }; - reverseWs: { - enable: boolean; - urls: string[]; - }; - GroupLocalTime: { - Record: boolean, - RecordList: Array - }; - debug: boolean; - heartInterval: number; - messagePostFormat: 'array' | 'string'; - enableLocalFile2Url: boolean; - musicSignUrl: ''; - reportSelfMessage: boolean; - token: ''; + [key: string]: any; + + http: { + enable: boolean; + host: ''; + port: number; + secret: ''; + enableHeart: boolean; + enablePost: boolean; + postUrls: string[]; + }; + ws: { + enable: boolean; + host: ''; + port: number; + }; + reverseWs: { + enable: boolean; + urls: string[]; + }; + GroupLocalTime: { + Record: boolean, + RecordList: Array + }; + debug: boolean; + heartInterval: number; + messagePostFormat: 'array' | 'string'; + enableLocalFile2Url: boolean; + musicSignUrl: ''; + reportSelfMessage: boolean; + token: ''; } class WebUiApiOB11ConfigWrapper { private retCredential: string = ''; + async Init(Credential: string) { this.retCredential = Credential; } + async GetOB11Config(): Promise { const ConfigResponse = await fetch('../api/OB11Config/GetConfig', { method: 'POST', @@ -53,6 +56,7 @@ class WebUiApiOB11ConfigWrapper { } return {} as OB11Config; } + async SetOB11Config(config: OB11Config): Promise { const ConfigResponse = await fetch('../api/OB11Config/SetConfig', { method: 'POST', @@ -71,4 +75,5 @@ class WebUiApiOB11ConfigWrapper { return false; } } + export const OB11ConfigWrapper = new WebUiApiOB11ConfigWrapper(); diff --git a/src/webui/vite.config.ts b/src/webui/vite.config.ts index e729090e..1cffeba7 100644 --- a/src/webui/vite.config.ts +++ b/src/webui/vite.config.ts @@ -1,13 +1,13 @@ import { defineConfig } from 'vite'; export default defineConfig({ - build:{ + build: { target: 'esnext', minify: false, lib: { entry: 'ui/NapCat.ts', formats: ['es'], fileName: () => 'renderer.js', - } - } -}); \ No newline at end of file + }, + }, +}); diff --git a/src/webui/webui.json b/src/webui/webui.json index 793b8cf1..a3573a05 100644 --- a/src/webui/webui.json +++ b/src/webui/webui.json @@ -4,5 +4,4 @@ "prefix": "", "token": "random", "loginRate": 3 - -} \ No newline at end of file +}