refactor: selfMsgPost

This commit is contained in:
手瓜一十雪 committed 2024-07-29 00:16:24 +08:00
1 parent 361a164f2a
commit cd256235da
4 files changed
+17 -21

No files matched your search

+11 -8
View File
@@ -240,16 +240,19 @@ export class NapCatOnebot11 {
};
msgListener.onMsgInfoListUpdate = (msgList) => {
this.postRecallMsg(msgList).then().catch(logError);
for (const msg of msgList.filter(e => e.senderUin == selfInfo.uin)) {
OB11Constructor.message(msg).then((_msg) => {
_msg.target_id = parseInt(msg.peerUin);
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) => {
OB11Constructor.message(msg).then((_msg) => {
_msg.target_id = parseInt(msg.peerUin);
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);
}
};
napCatCore.addListener(msgListener);
logDebug('ob11 msg listener added');