fix: 再次优化nodeid

This commit is contained in:
手瓜一十雪 2024-08-06 16:43:06 +08:00
parent c647771a6d
commit 7cb85ed73c
2 changed files with 10 additions and 2 deletions

View File

@ -94,6 +94,9 @@ export class NTQQMsgApi {
} | undefined> {
return napCatCore.session.getMsgService().getMultiMsg(peer, rootMsgId, parentMsgId);
}
static async ForwardMsg(peer: Peer, msgIds: string[]) {
return napCatCore.session.getMsgService().forwardMsg(msgIds, peer, [peer], new Map());
}
static async getLastestMsgByUids(peer: Peer, count: number = 20) {
let ret = await napCatCore.session.getMsgService().queryMsgsWithFilterEx('0', '0', '0', {
chatInfo: peer,

View File

@ -52,10 +52,15 @@ export async function handleForwardNode(destPeer: Peer, messageNodes: OB11Messag
// 一个node表示一个人的消息
const nodeId = messageNode.data.id;
// 有nodeId表示一个子转发消息卡片
// 建议改成自带 forward 而不是 clone再发
if (nodeId) {
const nodeMsg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(nodeId));
const nodeMsg = MessageUnique.getMsgIdAndPeerByShortId(parseInt(nodeId)) || MessageUnique.getPeerByMsgId(nodeId);
if (!nodeMsg) {
logError('转发消息失败,未找到消息', nodeId);
continue;
}
if (!needClone) {
nodeMsgIds.push(nodeMsg!.MsgId);
nodeMsgIds.push(nodeMsg.MsgId);
} else {
if (nodeMsg!.Peer.peerUid !== selfInfo.uid) {
// need cloning