mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: report self
This commit is contained in:
@@ -311,10 +311,20 @@ export class NapCatOneBot11Adapter {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//const msgIdSend = new LRUCache<string, boolean>(100);
|
const msgIdSend = new LRUCache<string, boolean>(100);
|
||||||
const recallMsgs = new LRUCache<string, boolean>(100);
|
const recallMsgs = new LRUCache<string, boolean>(100);
|
||||||
msgListener.onAddSendMsg = async msg => {
|
msgListener.onAddSendMsg = async msg => {
|
||||||
if (msg.sendStatus == SendStatusType.KSEND_STATUS_SUCCESS) {
|
if (msg.sendStatus == SendStatusType.KSEND_STATUS_SENDING) {
|
||||||
|
msgIdSend.put(msg.msgId, true)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
msgListener.onMsgInfoListUpdate = async msgList => {
|
||||||
|
this.emitRecallMsg(msgList, recallMsgs)
|
||||||
|
.catch(e => this.context.logger.logError.bind(this.context.logger)('处理消息失败', e));
|
||||||
|
for (const msg of msgList.filter(e => e.senderUin == this.core.selfInfo.uin)) {
|
||||||
|
if (msg.sendStatus == SendStatusType.KSEND_STATUS_SUCCESS && msgIdSend.get(msg.msgId)) {
|
||||||
|
msgIdSend.put(msg.msgId, true);
|
||||||
|
// 完成后再post
|
||||||
this.apis.MsgApi.parseMessage(msg)
|
this.apis.MsgApi.parseMessage(msg)
|
||||||
.then((ob11Msg) => {
|
.then((ob11Msg) => {
|
||||||
if (!ob11Msg) return;
|
if (!ob11Msg) return;
|
||||||
@@ -331,31 +341,7 @@ export class NapCatOneBot11Adapter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
msgListener.onMsgInfoListUpdate = async msgList => {
|
|
||||||
this.emitRecallMsg(msgList, recallMsgs)
|
|
||||||
.catch(e => this.context.logger.logError.bind(this.context.logger)('处理消息失败', e));
|
|
||||||
// for (const msg of msgList.filter(e => e.senderUin == this.core.selfInfo.uin)) {
|
|
||||||
// if (msg.sendStatus == SendStatusType.KSEND_STATUS_SUCCESS && !msgIdSend.get(msg.msgId)) {
|
|
||||||
// msgIdSend.put(msg.msgId, true);
|
|
||||||
// // 完成后再post
|
|
||||||
// this.apis.MsgApi.parseMessage(msg)
|
|
||||||
// .then((ob11Msg) => {
|
|
||||||
// if (!ob11Msg) return;
|
|
||||||
// ob11Msg.target_id = parseInt(msg.peerUin);
|
|
||||||
// if (this.configLoader.configData.reportSelfMessage) {
|
|
||||||
// msg.id = MessageUnique.createUniqueMsgId({
|
|
||||||
// chatType: msg.chatType,
|
|
||||||
// peerUid: msg.peerUid,
|
|
||||||
// guildId: '',
|
|
||||||
// }, msg.msgId);
|
|
||||||
// this.emitMsg(msg);
|
|
||||||
// } else {
|
|
||||||
// // logOB11Message(this.core, ob11Msg);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.context.session.getMsgService().addKernelMsgListener(
|
this.context.session.getMsgService().addKernelMsgListener(
|
||||||
|
Reference in New Issue
Block a user