From 0cdb8cecbf6afb4c67f73a2e66a858e386185096 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: Fri, 12 Jul 2024 11:02:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BE=A4=E7=B2=BE=E5=8D=8E=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=9C=AA=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/src/apis/group.ts | 23 +++++++++++++++++++++-- src/core/src/entities/msg.ts | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/core/src/apis/group.ts b/src/core/src/apis/group.ts index f9d1c4ef..697f4600 100644 --- a/src/core/src/apis/group.ts +++ b/src/core/src/apis/group.ts @@ -31,10 +31,29 @@ export class NTQQGroupApi { static async DelGroupFileFolder(groupCode: string, folderId: string) { return napCatCore.session.getRichMediaService().deleteGroupFolder(groupCode, folderId); } - static async addGroupEssence(){ + static async addGroupEssence(GroupCode: string, msgId: string) { + // 代码没测过 // 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom + let MsgData = await napCatCore.session.getMsgService().getMsgsIncludeSelf({ chatType: 2, guildId: '', peerUid: GroupCode }, msgId, 1, false); + let param = { + groupCode: GroupCode, + msgRandom: parseInt(MsgData.msgList[0].msgRandom), + msgSeq: parseInt(MsgData.msgList[0].msgSeq) + }; // GetMsgByShoretID(ShoretID); -> MsgService.getMsgs(Peer,MsgId,1,false); -> 组出参数 - //return napCatCore.session.getGroupService().addGroupEssence(); + return napCatCore.session.getGroupService().addGroupEssence(param); + } + static async removeGroupEssence(GroupCode: string, msgId: string) { + // 代码没测过 + // 需要 ob11msgid->msgId + (peer) -> msgSeq + msgRandom + let MsgData = await napCatCore.session.getMsgService().getMsgsIncludeSelf({ chatType: 2, guildId: '', peerUid: GroupCode }, msgId, 1, false); + let param = { + groupCode: GroupCode, + msgRandom: parseInt(MsgData.msgList[0].msgRandom), + msgSeq: parseInt(MsgData.msgList[0].msgSeq) + }; + // GetMsgByShoretID(ShoretID); -> MsgService.getMsgs(Peer,MsgId,1,false); -> 组出参数 + return napCatCore.session.getGroupService().removeGroupEssence(param); } static async getSingleScreenNotifies(num: number) { let [_retData, _doubt, _seq, notifies] = await NTEventDispatch.CallNormalEvent diff --git a/src/core/src/entities/msg.ts b/src/core/src/entities/msg.ts index 3c46cd71..df8594e1 100644 --- a/src/core/src/entities/msg.ts +++ b/src/core/src/entities/msg.ts @@ -492,6 +492,7 @@ export interface MultiForwardMsgElement { } export interface RawMessage { + msgRandom: string; // int32, 自己维护的消息id id?: number;