From 2ea025047f59c557f63522dd3c606158d22d9377 Mon Sep 17 00:00:00 2001 From: pk5ls20 Date: Wed, 13 Nov 2024 17:48:42 +0800 Subject: [PATCH] feat: comment out logic that is not currently needed --- src/onebot/index.ts | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/onebot/index.ts b/src/onebot/index.ts index 6b8986cc..712a1e01 100644 --- a/src/onebot/index.ts +++ b/src/onebot/index.ts @@ -75,7 +75,7 @@ export class NapCatOneBot11Adapter { }; this.actions = createActionMap(this, core); this.networkManager = new OB11NetworkManager(); - this.registerNative(core, context).catch(e => this.context.logger.logWarn.bind(this.context.logger)('初始化Native失败', e)).then(); + // this.registerNative(core, context).catch(e => this.context.logger.logWarn.bind(this.context.logger)('初始化Native失败', e)).then(); this.InitOneBot() .catch(e => this.context.logger.logError.bind(this.context.logger)('初始化OneBot失败', e)); @@ -84,27 +84,27 @@ export class NapCatOneBot11Adapter { try { this.nativeCore = new Native(context.pathWrapper.binaryPath); if (!this.nativeCore.inited) throw new Error('Native Not Init'); - this.nativeCore.registerRecallCallback(async (hex: string) => { - try { - const data = decodeMessage(Buffer.from(hex, 'hex')); - //data.MsgHead.BodyInner.MsgType SubType - const bodyInner = data.msgHead?.bodyInner; - //context.logger.log("[appNative] Parse MsgType:" + bodyInner.msgType + " / SubType:" + bodyInner.subType); - if (bodyInner && bodyInner.msgType == 732 && bodyInner.subType == 17 && data?.msgHead?.noifyData?.innerData) { - const RecallData = Buffer.from(data?.msgHead?.noifyData?.innerData); - //跳过 4字节 群号 + 不知道的1字节 +2字节 长度 - const uid = RecallData.readUint32BE(); - const buffer = Buffer.from(RecallData.toString('hex').slice(14), 'hex'); - const seq: number = decodeRecallGroup(buffer).recallDetails.subDetail.msgSeq; - const peer: Peer = { chatType: ChatType.KCHATTYPEGROUP, peerUid: uid.toString() }; - context.logger.log("[Native] 群消息撤回 Peer: " + uid.toString() + " / MsgSeq:" + seq); - const msgs = await core.apis.MsgApi.queryMsgsWithFilterExWithSeq(peer, seq.toString()); - this.recallMsgCache.put(msgs.msgList[0].msgId, msgs.msgList[0]); - } - } catch (error: any) { - context.logger.logWarn("[Native] Error:", (error as Error).message, ' HEX:', hex); - } - }); + // this.nativeCore.registerRecallCallback(async (hex: string) => { + // try { + // const data = decodeMessage(Buffer.from(hex, 'hex')); + // //data.MsgHead.BodyInner.MsgType SubType + // const bodyInner = data.msgHead?.bodyInner; + // //context.logger.log("[appNative] Parse MsgType:" + bodyInner.msgType + " / SubType:" + bodyInner.subType); + // if (bodyInner && bodyInner.msgType == 732 && bodyInner.subType == 17 && data?.msgHead?.noifyData?.innerData) { + // const RecallData = Buffer.from(data?.msgHead?.noifyData?.innerData); + // //跳过 4字节 群号 + 不知道的1字节 +2字节 长度 + // const uid = RecallData.readUint32BE(); + // const buffer = Buffer.from(RecallData.toString('hex').slice(14), 'hex'); + // const seq: number = decodeRecallGroup(buffer).recallDetails.subDetail.msgSeq; + // const peer: Peer = { chatType: ChatType.KCHATTYPEGROUP, peerUid: uid.toString() }; + // context.logger.log("[Native] 群消息撤回 Peer: " + uid.toString() + " / MsgSeq:" + seq); + // const msgs = await core.apis.MsgApi.queryMsgsWithFilterExWithSeq(peer, seq.toString()); + // this.recallMsgCache.put(msgs.msgList[0].msgId, msgs.msgList[0]); + // } + // } catch (error: any) { + // context.logger.logWarn("[Native] Error:", (error as Error).message, ' HEX:', hex); + // } + // }); } catch (error) { context.logger.logWarn("[Native] Error:", (error as Error).message); return;