refactor: output log ignore ntqq logger event

This commit is contained in:
linyuchen 2024-03-16 12:34:00 +08:00
parent f42727c8ad
commit c313fcd491
5 changed files with 20 additions and 8 deletions

View File

@ -1,10 +1,10 @@
{
"manifest_version": 4,
"type": "extension",
"name": "LLOneBot v3.15.1",
"name": "LLOneBot v3.15.2",
"slug": "LLOneBot",
"description": "LiteLoaderQQNT的OneBotApi,不支持商店在线更新",
"version": "3.15.1",
"version": "3.15.2",
"icon": "./icon.jpg",
"authors": [
{

View File

@ -2,7 +2,7 @@ import fs from "fs";
import {Config, OB11Config} from './types';
import {mergeNewProperties} from "./utils";
export const HOOK_LOG = false;
export const HOOK_LOG = true;
export const ALLOW_SEND_TEMP_MSG = false;

View File

@ -54,7 +54,13 @@ let receiveHooks: Array<{
export function hookNTQQApiReceive(window: BrowserWindow) {
const originalSend = window.webContents.send;
const patchSend = (channel: string, ...args: NTQQApiReturnData) => {
HOOK_LOG && log(`received ntqq api message: ${channel}`, JSON.stringify(args))
try {
if (!args[0]?.eventName?.startsWith("ns-LoggerApi")) {
HOOK_LOG && log(`received ntqq api message: ${channel}`, JSON.stringify(args))
}
} catch (e) {
}
if (args?.[1] instanceof Array) {
for (let receiveData of args?.[1]) {
const ntQQApiMethodName = receiveData.cmdName;
@ -98,7 +104,13 @@ export function hookNTQQApiCall(window: BrowserWindow) {
const proxyIpcMsg = new Proxy(ipc_message_proxy, {
apply(target, thisArg, args) {
HOOK_LOG && log("call NTQQ api", thisArg, args);
try {
if (args[3][1][0] !== "info") {
HOOK_LOG && log("call NTQQ api", thisArg, args);
}
} catch (e) {
}
return target.apply(thisArg, args);
},
});
@ -241,7 +253,7 @@ registerReceiveHook<{ msgList: Array<RawMessage> }>(ReceiveCmd.NEW_MSG, (payload
pathList.push(...Object.values(msgElement.picElement.thumbPath))
}
const aioOpGrayTipElement = msgElement.grayTipElement?.aioOpGrayTipElement
if (aioOpGrayTipElement){
if (aioOpGrayTipElement) {
tempGroupCodeMap[aioOpGrayTipElement.peerUid] = aioOpGrayTipElement.fromGrpCodeOfTmpChat;
}

View File

@ -270,7 +270,7 @@ export class OB11Constructor {
}
}
else if (element.fileElement){
return new OB11GroupUploadNoticeEvent(parseInt(msg.peerUid), parseInt(msg.senderUin), {id: element.fileElement.fileName, name: element.fileElement.fileName, size: parseInt(element.fileElement.fileSize)})
return new OB11GroupUploadNoticeEvent(parseInt(msg.peerUid), parseInt(msg.senderUin), {id: element.fileElement.fileUuid, name: element.fileElement.fileName, size: parseInt(element.fileElement.fileSize)})
}
if (grayTipElement) {

View File

@ -1 +1 @@
export const version = "3.15.1"
export const version = "3.15.2"