From c5434efd56326fe4d21853c14f77f171a7140f3a Mon Sep 17 00:00:00 2001 From: Clansty Date: Tue, 21 Jan 2025 22:02:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=BA=E6=96=B0=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E9=BE=99=E8=A1=A8=E6=83=85=E6=8F=90=E4=BE=9B=20resultId=20?= =?UTF-8?q?=E5=92=8C=20chainCount=20=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/packet/message/element.ts | 8 +++++--- src/core/packet/transformer/proto/message/element.ts | 6 +++--- src/core/types/element.ts | 3 ++- src/onebot/api/msg.ts | 9 +++++++-- src/onebot/types/message.ts | 4 +++- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/core/packet/message/element.ts b/src/core/packet/message/element.ts index cedcf44e..5da50161 100644 --- a/src/core/packet/message/element.ts +++ b/src/core/packet/message/element.ts @@ -160,10 +160,12 @@ export class PacketMsgReplyElement extends IPacketMsgElement { export class PacketMsgFaceElement extends IPacketMsgElement { faceId: number; isLargeFace: boolean; + resultId?: string; constructor(element: SendFaceElement) { super(element); this.faceId = element.faceElement.faceIndex; + this.resultId = element.faceElement.resultId; this.isLargeFace = element.faceElement.faceType === FaceType.AniSticke; } @@ -176,10 +178,10 @@ export class PacketMsgFaceElement extends IPacketMsgElement { aniStickerPackId: "1", aniStickerId: "8", faceId: this.faceId, - field4: 1, - field6: "", + sourceType: 1, + resultId: this.resultId, preview: "", - field9: 1 + ramdomType: 1 }), businessType: 1 } diff --git a/src/core/packet/transformer/proto/message/element.ts b/src/core/packet/transformer/proto/message/element.ts index c68a2ae8..606efa04 100644 --- a/src/core/packet/transformer/proto/message/element.ts +++ b/src/core/packet/transformer/proto/message/element.ts @@ -342,11 +342,11 @@ export const QBigFaceExtra = { AniStickerPackId: ProtoField(1, ScalarType.STRING, true), AniStickerId: ProtoField(2, ScalarType.STRING, true), faceId: ProtoField(3, ScalarType.INT32, true), - Field4: ProtoField(4, ScalarType.INT32, true), + sourceType: ProtoField(4, ScalarType.INT32, true), AniStickerType: ProtoField(5, ScalarType.INT32, true), - field6: ProtoField(6, ScalarType.STRING, true), + resultId: ProtoField(6, ScalarType.STRING, true), preview: ProtoField(7, ScalarType.STRING, true), - field9: ProtoField(9, ScalarType.INT32, true), + ramdomType: ProtoField(9, ScalarType.INT32, true), }; export const QSmallFaceExtra = { diff --git a/src/core/types/element.ts b/src/core/types/element.ts index be9eec2d..e6c71c57 100644 --- a/src/core/types/element.ts +++ b/src/core/types/element.ts @@ -40,6 +40,7 @@ export interface FaceElement { resultId?: string; surpriseId?: string; randomType?: number; + chainCount?: number; } export interface GrayTipRovokeElement { operatorRole: string; @@ -348,4 +349,4 @@ export type SendShareLocationElement = SendElementBase { + [OB11MessageDataType.face]: async ({ data: { id, resultId, chainCount } }) => { const parsedFaceId = +id; // 从face_config.json中获取表情名称 const sysFaces = faceConfig.sysface; @@ -491,6 +494,8 @@ export class OneBotMsgApi { stickerType: face.AniStickerType, packId: face.AniStickerPackId, sourceType: 1, + resultId, + chainCount, }, }; }, diff --git a/src/onebot/types/message.ts b/src/onebot/types/message.ts index ada739b7..6d9aabd0 100644 --- a/src/onebot/types/message.ts +++ b/src/onebot/types/message.ts @@ -164,6 +164,8 @@ export interface OB11MessageFace { type: OB11MessageDataType.face; data: { id: string; + resultId?: string; + chainCount?: number; }; } @@ -276,4 +278,4 @@ export interface OB11PostContext { message_type?: 'private' | 'group'; user_id?: string; group_id?: string; -} \ No newline at end of file +} From 2a4b0cbc0951a308ba642cddea5231d77152fce7 Mon Sep 17 00:00:00 2001 From: Clansty Date: Tue, 21 Jan 2025 22:10:52 +0800 Subject: [PATCH 2/2] force resultId to string --- src/core/packet/message/element.ts | 2 +- src/core/packet/transformer/proto/message/element.ts | 2 +- src/onebot/api/msg.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/packet/message/element.ts b/src/core/packet/message/element.ts index 5da50161..3dfd7ec3 100644 --- a/src/core/packet/message/element.ts +++ b/src/core/packet/message/element.ts @@ -181,7 +181,7 @@ export class PacketMsgFaceElement extends IPacketMsgElement { sourceType: 1, resultId: this.resultId, preview: "", - ramdomType: 1 + randomType: 1 }), businessType: 1 } diff --git a/src/core/packet/transformer/proto/message/element.ts b/src/core/packet/transformer/proto/message/element.ts index 606efa04..ab419029 100644 --- a/src/core/packet/transformer/proto/message/element.ts +++ b/src/core/packet/transformer/proto/message/element.ts @@ -346,7 +346,7 @@ export const QBigFaceExtra = { AniStickerType: ProtoField(5, ScalarType.INT32, true), resultId: ProtoField(6, ScalarType.STRING, true), preview: ProtoField(7, ScalarType.STRING, true), - ramdomType: ProtoField(9, ScalarType.INT32, true), + randomType: ProtoField(9, ScalarType.INT32, true), }; export const QSmallFaceExtra = { diff --git a/src/onebot/api/msg.ts b/src/onebot/api/msg.ts index a4f8f5dd..c0ced889 100644 --- a/src/onebot/api/msg.ts +++ b/src/onebot/api/msg.ts @@ -494,7 +494,7 @@ export class OneBotMsgApi { stickerType: face.AniStickerType, packId: face.AniStickerPackId, sourceType: 1, - resultId, + resultId: resultId?.toString(), chainCount, }, };