diff --git a/src/onebot11/constructor.ts b/src/onebot11/constructor.ts index ebde8469..f4d798a7 100644 --- a/src/onebot11/constructor.ts +++ b/src/onebot11/constructor.ts @@ -453,7 +453,7 @@ export class OB11Constructor { let pokedetail: any[] = json.items; //筛选item带有uid的元素 pokedetail = pokedetail.filter(item => item.uid); - console.log("[NapCat] 群拍一拍 群:", pokedetail, parseInt(msg.peerUid), " ", await NTQQUserApi.getUinByUid(pokedetail[0].uid), "拍了拍", await NTQQUserApi.getUinByUid(pokedetail[1].uid)); + //console.log("[NapCat] 群拍一拍 群:", pokedetail, parseInt(msg.peerUid), " ", await NTQQUserApi.getUinByUid(pokedetail[0].uid), "拍了拍", await NTQQUserApi.getUinByUid(pokedetail[1].uid)); if (pokedetail.length == 2) { return new OB11GroupPokeEvent(parseInt(msg.peerUid), parseInt((await NTQQUserApi.getUinByUid(pokedetail[0].uid))!), parseInt((await NTQQUserApi.getUinByUid(pokedetail[1].uid))!)); } diff --git a/src/onebot11/main.ts b/src/onebot11/main.ts index 8c1d4b0c..85563fa1 100644 --- a/src/onebot11/main.ts +++ b/src/onebot11/main.ts @@ -116,6 +116,7 @@ export class NapCatOnebot11 { try { // 生产环境会自己去掉 const hex = buf2hex(Buffer.from(protobufData)); + //console.log(hex); const sysMsg = SysData.fromBinary(Buffer.from(protobufData)); const peeruin = sysMsg.header[0].peerNumber; const peeruid = sysMsg.header[0].peerString; @@ -124,18 +125,18 @@ export class NapCatOnebot11 { const subType1 = sysMsg.body[0].subType1; let pokeEvent: OB11FriendPokeEvent | OB11GroupPokeEvent; //console.log(peeruid); - // if (MsgType == 528 && subType0 == 290 && hex.length < 250 && hex.endsWith('04')) { - // // 防止上报两次 私聊戳一戳 - // if (PokeCache.has(peeruid)) { - // log('[私聊] 用户 ', peeruin, ' 对你戳一戳'); - // pokeEvent = new OB11FriendPokeEvent(peeruin); - // postOB11Event(pokeEvent); - // } - // PokeCache.set(peeruid, false); - // setTimeout(() => { - // PokeCache.delete(peeruid); - // }, 1000); - // } + if (MsgType == 528 && subType0 == 290 && hex.length < 250 && hex.endsWith('04')) { + // 防止上报两次 私聊戳一戳 + if (PokeCache.has(peeruid)) { + //log('[私聊] 用户 ', peeruin, ' 对你戳一戳'); + pokeEvent = new OB11FriendPokeEvent(parseInt(selfInfo.uin), peeruin); + postOB11Event(pokeEvent); + } + PokeCache.set(peeruid, false); + setTimeout(() => { + PokeCache.delete(peeruid); + }, 1000); + } // if (MsgType == 732 && subType0 == 20 && hex.length < 150 && hex.endsWith('04')) { // // 防止上报两次 群聊戳一戳 // if (PokeCache.has(peeruid)) {