From 3f7a85d80bf943dcce3e35185348f7cff5dc2284 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, 20 Jul 2024 16:00:01 +0800 Subject: [PATCH] feat: essence get_sender --- src/onebot11/constructor.ts | 5 +++-- src/onebot11/event/notice/OB11GroupEssenceEvent.ts | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/onebot11/constructor.ts b/src/onebot11/constructor.ts index d545c917..a8a0fd62 100644 --- a/src/onebot11/constructor.ts +++ b/src/onebot11/constructor.ts @@ -487,7 +487,7 @@ export class OB11Constructor { } if (grayTipElement.jsonGrayTipElement.busiId == 2401) { let searchParams = new URL(json[0].jp).searchParams; - let msgSeq = searchParams.get('msgSeq'); + let msgSeq = searchParams.get('msgSeq')!; let Group = searchParams.get('groupCode'); let Businessid = searchParams.get('businessid'); let Peer: Peer = { @@ -495,7 +495,8 @@ export class OB11Constructor { chatType: ChatType.group, peerUid: Group! }; - return new OB11GroupEssenceEvent(parseInt(msg.peerUid), msg.id!); + let msgData = await NTQQMsgApi.getMsgsBySeqAndCount(Peer, msgSeq.toString(), 1, true, true); + return new OB11GroupEssenceEvent(parseInt(msg.peerUid), msg.id!, parseInt(msgData.msgList[0].senderUin)); // 获取MsgSeq+Peer可获取具体消息 } if (grayTipElement.jsonGrayTipElement.busiId == 2407) { diff --git a/src/onebot11/event/notice/OB11GroupEssenceEvent.ts b/src/onebot11/event/notice/OB11GroupEssenceEvent.ts index d70ad4e9..4a4bf195 100644 --- a/src/onebot11/event/notice/OB11GroupEssenceEvent.ts +++ b/src/onebot11/event/notice/OB11GroupEssenceEvent.ts @@ -2,11 +2,13 @@ import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent'; export class OB11GroupEssenceEvent extends OB11GroupNoticeEvent { notice_type = 'essence'; message_id: number; + sender_id: number; sub_type: 'add' | 'delete' = "add"; - constructor(groupId: number, message_id: number) { + constructor(groupId: number, message_id: number, sender_id: number) { super(); this.group_id = groupId; this.message_id = message_id; + this.sender_id = sender_id; } }