From 496d56f2974db8bf8fbe7c508ad5d0bb2a507a44 Mon Sep 17 00:00:00 2001
From: idranme <idranme@outlook.com>
Date: Mon, 30 Sep 2024 00:49:58 +0800
Subject: [PATCH] feat

---
 src/ntqqapi/api/msg.ts | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/ntqqapi/api/msg.ts b/src/ntqqapi/api/msg.ts
index e119444..dfae31f 100644
--- a/src/ntqqapi/api/msg.ts
+++ b/src/ntqqapi/api/msg.ts
@@ -61,7 +61,7 @@ export class NTQQMsgApi extends Service {
     return await invoke('nodeIKernelMsgService/getAioFirstViewLatestMsgs', [{ peer, cnt }, null])
   }
 
-  async getMsgsByMsgId(peer: Peer | undefined, msgIds: string[] | undefined) {
+  async getMsgsByMsgId(peer: Peer, msgIds: string[]) {
     if (!peer) throw new Error('peer is not allowed')
     if (!msgIds) throw new Error('msgIds is not allowed')
     const session = getSession()
@@ -275,4 +275,27 @@ export class NTQQMsgApi extends Service {
       return `${Date.now()}${random}`
     }
   }
+
+  async queryMsgsById(chatType: ChatType, msgId: string) {
+    const msgTime = this.getMsgTimeFromId(msgId)
+    return await invoke('nodeIKernelMsgService/queryMsgsWithFilterEx', [{
+      msgId,
+      msgTime: '0',
+      msgSeq: '0',
+      params: {
+        chatInfo: {
+          peerUid: '',
+          chatType
+        },
+        filterMsgToTime: msgTime,
+        filterMsgFromTime: msgTime,
+        isIncludeCurrent: true,
+        pageLimit: 1,
+      }
+    }, null])
+  }
+
+  getMsgTimeFromId(msgId: string) {
+    return String(BigInt(msgId) >> 32n)
+  }
 }