fix: 多次post

This commit is contained in:
手瓜一十雪 2024-07-29 11:32:55 +08:00
parent 15a77b8070
commit 617592d90a

View File

@ -241,14 +241,20 @@ export class NapCatOnebot11 {
msgListener.onMsgInfoListUpdate = (msgList) => {
this.postRecallMsg(msgList).then().catch(logError);
for (const msg of msgList.filter(e => e.senderUin == selfInfo.uin)) {
// console.log(msg);
if (msg.sendStatus !== 2) {
//完成后再post
return;
}
OB11Constructor.message(msg).then((_msg) => {
_msg.target_id = parseInt(msg.peerUin);
logMessage(_msg as OB11Message).then().catch(logError);
if (ob11Config.reportSelfMessage) {
msg.id = MessageUnique.createMsg({ chatType: msg.chatType, peerUid: msg.peerUid, guildId: '' }, msg.msgId);
this.postReceiveMsg([msg]).then().catch(logError);
} else {
logMessage(_msg as OB11Message).then().catch(logError);
}
}).catch(logError);
if (ob11Config.reportSelfMessage) {
msg.id = MessageUnique.createMsg({ chatType: msg.chatType, peerUid: msg.peerUid, guildId: '' }, msg.msgId);
this.postReceiveMsg([msg]).then().catch(logError);
}
}
};
msgListener.onAddSendMsg = (msg) => {