mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
fix: 开启独立窗口后重复上报
This commit is contained in:
parent
175307d980
commit
c75337b8cb
@ -151,9 +151,19 @@ function onLoad() {
|
|||||||
log(arg);
|
log(arg);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let postedMsgIds: Record<string, any> = {}
|
||||||
async function postReceiveMsg(msgList: RawMessage[]) {
|
async function postReceiveMsg(msgList: RawMessage[]) {
|
||||||
const {debug, reportSelfMessage} = getConfigUtil().getConfig();
|
const {debug, reportSelfMessage} = getConfigUtil().getConfig();
|
||||||
for (let message of msgList) {
|
for (let message of msgList) {
|
||||||
|
if (postedMsgIds[message.msgId]) { // 如果QQ开启了独立窗口,会导致消息重复上报,这里加个记录避免重复上报
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
postedMsgIds[message.msgId] = true
|
||||||
|
// 超过容量清空
|
||||||
|
if (Object.keys(postedMsgIds).length > 10000) {
|
||||||
|
postedMsgIds = {}
|
||||||
|
}
|
||||||
|
|
||||||
// log("收到新消息", message.msgId, message.msgSeq)
|
// log("收到新消息", message.msgId, message.msgSeq)
|
||||||
// if (message.senderUin !== selfInfo.uin){
|
// if (message.senderUin !== selfInfo.uin){
|
||||||
message.msgShortId = await dbUtil.addMsg(message);
|
message.msgShortId = await dbUtil.addMsg(message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user