From 96c63e468979b3574a3798077a3a73f175e1a20a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sat, 21 Dec 2024 14:19:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E4=BD=BF=E7=94=A8=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/helper/adaptSysMessageDecoder.ts | 49 ----------------------- 1 file changed, 49 deletions(-) delete mode 100644 src/core/helper/adaptSysMessageDecoder.ts diff --git a/src/core/helper/adaptSysMessageDecoder.ts b/src/core/helper/adaptSysMessageDecoder.ts deleted file mode 100644 index 6bd9122a..00000000 --- a/src/core/helper/adaptSysMessageDecoder.ts +++ /dev/null @@ -1,49 +0,0 @@ -// TODO: further refactor in NapCat.Packet v2 -import { NapProtoMsg, ProtoField, ScalarType } from "@napneko/nap-proto-core"; - -const BodyInner = { - msgType: ProtoField(1, ScalarType.UINT32, true), - subType: ProtoField(2, ScalarType.UINT32, true) -}; - -const NoifyData = { - skip: ProtoField(1, ScalarType.BYTES, true), - innerData: ProtoField(2, ScalarType.BYTES, true) -}; - -const MsgHead = { - bodyInner: ProtoField(2, () => BodyInner, true), - noifyData: ProtoField(3, () => NoifyData, true) -}; - -const Message = { - msgHead: ProtoField(1, () => MsgHead) -}; - -const SubDetail = { - msgSeq: ProtoField(1, ScalarType.UINT32), - msgTime: ProtoField(2, ScalarType.UINT32), - senderUid: ProtoField(6, ScalarType.STRING) -}; - -const RecallDetails = { - operatorUid: ProtoField(1, ScalarType.STRING), - subDetail: ProtoField(3, () => SubDetail) -}; - -const RecallGroup = { - type: ProtoField(1, ScalarType.INT32), - peerUid: ProtoField(4, ScalarType.UINT32), - recallDetails: ProtoField(11, () => RecallDetails), - grayTipsSeq: ProtoField(37, ScalarType.UINT32) -}; - -export function decodeMessage(buffer: Uint8Array) { - const msg = new NapProtoMsg(Message); - return msg.decode(buffer); -} - -export function decodeRecallGroup(buffer: Uint8Array){ - const msg = new NapProtoMsg(RecallGroup); - return msg.decode(buffer); -}