From 41a8dc840f9e886dec987d2fbb430696526a726d Mon Sep 17 00:00:00 2001 From: "Wesley F. Young" Date: Tue, 3 Sep 2024 23:54:46 +0800 Subject: [PATCH] chore: completely comment onRecvSysMsg --- src/onebot/index.ts | 52 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/src/onebot/index.ts b/src/onebot/index.ts index c24bcea4..4d9ec98c 100644 --- a/src/onebot/index.ts +++ b/src/onebot/index.ts @@ -238,33 +238,35 @@ export class NapCatOneBot11Adapter { private initMsgListener() { const msgListener = new NodeIKernelMsgListener(); + /* msgListener.onRecvSysMsg = async () => { - // const sysMsg = SysMessage.fromBinary(Uint8Array.from(msg)); - // if (sysMsg.msgSpec.length === 0) { - // return; - // } - // const { msgType, subType, subSubType } = sysMsg.msgSpec[0]; - // if (msgType === 732 && subType === 16 && subSubType === 16) { - // const greyTip = GreyTipWrapper.fromBinary(Uint8Array.from(sysMsg.bodyWrapper!.wrappedBody.slice(7))); - // if (greyTip.subTypeId === 36) { - // const emojiLikeToOthers = EmojiLikeToOthersWrapper1 - // .fromBinary(greyTip.rest) - // .wrapper! - // .body!; - // if (emojiLikeToOthers.attributes?.operation !== 1) { // Un-like - // return; - // } - // const eventOrEmpty = await this.apis.GroupApi.createGroupEmojiLikeEvent( - // greyTip.groupCode.toString(), - // await this.core.apis.UserApi.getUinByUidV2(emojiLikeToOthers.attributes!.senderUid), - // emojiLikeToOthers.msgSpec!.msgSeq.toString(), - // emojiLikeToOthers.attributes!.emojiId, - // ); - // // eslint-disable-next-line @typescript-eslint/no-unused-expressions - // eventOrEmpty && await this.networkManager.emitEvent(eventOrEmpty); - // } - // } + const sysMsg = SysMessage.fromBinary(Uint8Array.from(msg)); + if (sysMsg.msgSpec.length === 0) { + return; + } + const { msgType, subType, subSubType } = sysMsg.msgSpec[0]; + if (msgType === 732 && subType === 16 && subSubType === 16) { + const greyTip = GreyTipWrapper.fromBinary(Uint8Array.from(sysMsg.bodyWrapper!.wrappedBody.slice(7))); + if (greyTip.subTypeId === 36) { + const emojiLikeToOthers = EmojiLikeToOthersWrapper1 + .fromBinary(greyTip.rest) + .wrapper! + .body!; + if (emojiLikeToOthers.attributes?.operation !== 1) { // Un-like + return; + } + const eventOrEmpty = await this.apis.GroupApi.createGroupEmojiLikeEvent( + greyTip.groupCode.toString(), + await this.core.apis.UserApi.getUinByUidV2(emojiLikeToOthers.attributes!.senderUid), + emojiLikeToOthers.msgSpec!.msgSeq.toString(), + emojiLikeToOthers.attributes!.emojiId, + ); + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + eventOrEmpty && await this.networkManager.emitEvent(eventOrEmpty); + } + } }; + */ msgListener.onInputStatusPush = async data => { const uin = await this.core.apis.UserApi.getUinByUidV2(data.fromUin);