mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
chore
This commit is contained in:
parent
e1e5c278b9
commit
1f02c98c8f
@ -2,6 +2,7 @@ import { NTMethod } from './ntcall'
|
||||
import { log } from '@/common/utils'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import { ipcMain } from 'electron'
|
||||
import { Dict } from 'cosmokit'
|
||||
|
||||
export const hookApiCallbacks: Record<string, (res: any) => void> = {}
|
||||
|
||||
@ -45,7 +46,7 @@ export function startHook() {
|
||||
const senderExclude = Symbol()
|
||||
|
||||
ipcMain.emit = new Proxy(ipcMain.emit, {
|
||||
apply(target, thisArg, args: [eventName: string, ...args: any]) {
|
||||
apply(target, thisArg, args: [channel: string, ...args: any]) {
|
||||
if (args[2]?.eventName?.startsWith('ns-LoggerApi')) {
|
||||
return target.apply(thisArg, args)
|
||||
}
|
||||
@ -56,7 +57,7 @@ export function startHook() {
|
||||
if (event.sender && !event.sender[senderExclude]) {
|
||||
event.sender[senderExclude] = true
|
||||
event.sender.send = new Proxy(event.sender.send, {
|
||||
apply(target, thisArg, args: any[]) {
|
||||
apply(target, thisArg, args: [channel: string, meta: Dict, data: Dict[]]) {
|
||||
if (args[1].eventName?.startsWith('ns-LoggerApi')) {
|
||||
return target.apply(thisArg, args)
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ export class Native {
|
||||
public activated = false
|
||||
private crychic?: Dict
|
||||
private seq = 0
|
||||
private cb: Map<number, Function> = new Map()
|
||||
private cb: Map<number, (res: any) => void> = new Map()
|
||||
|
||||
constructor(private ctx: Context) {
|
||||
ctx.on('ready', () => {
|
||||
|
@ -7,10 +7,7 @@ import { ChatCacheListItemBasic, CacheFileType } from '@/ntqqapi/types'
|
||||
export default class CleanCache extends BaseAction<void, void> {
|
||||
actionName = ActionName.CleanCache
|
||||
|
||||
protected _handle(): Promise<void> {
|
||||
return new Promise<void>(async (res, rej) => {
|
||||
try {
|
||||
// dbUtil.clearCache()
|
||||
protected async _handle(): Promise<void> {
|
||||
const cacheFilePaths: string[] = []
|
||||
|
||||
await this.ctx.ntFileCacheApi.setCacheSilentScan(false)
|
||||
@ -49,20 +46,13 @@ export default class CleanCache extends BaseAction<void, void> {
|
||||
for (const name in CacheFileType) {
|
||||
if (!isNaN(parseInt(name))) continue
|
||||
|
||||
const fileTypeAny: any = CacheFileType[name]
|
||||
const fileType: CacheFileType = fileTypeAny
|
||||
const fileType = CacheFileType[name] as unknown as CacheFileType
|
||||
|
||||
cacheFileList.push(...(await this.ctx.ntFileCacheApi.getFileCacheInfo(fileType)).infos.map((file) => file.fileKey))
|
||||
}
|
||||
|
||||
// 一并清除
|
||||
await this.ctx.ntFileCacheApi.clearChatCache(chatCacheList, cacheFileList)
|
||||
res()
|
||||
} catch (e) {
|
||||
console.error('清理缓存时发生了错误')
|
||||
rej(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ export class MessageEncoder {
|
||||
}
|
||||
}
|
||||
|
||||
async generate(content: any[]) {
|
||||
async generate(content: OB11MessageData[]) {
|
||||
await this.render(content)
|
||||
return {
|
||||
multiMsgItems: [{
|
||||
|
@ -91,7 +91,7 @@ class SatoriAdapter extends Service {
|
||||
input.subMsgType === 12 &&
|
||||
input.elements[0]?.grayTipElement?.xmlElement?.templId === '10382'
|
||||
) {
|
||||
|
||||
// 机器人被表情回应
|
||||
}
|
||||
else {
|
||||
// 普通的消息
|
||||
|
Loading…
x
Reference in New Issue
Block a user