feat: uin转换优化&poke支持重写

This commit is contained in:
手瓜一十雪
2024-07-11 12:28:11 +08:00
parent 9a0aca1e60
commit 14cd4dcb9f
6 changed files with 75 additions and 43 deletions

View File

@@ -124,30 +124,30 @@ 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 == 732 && subType0 == 20 && hex.length < 150 && hex.endsWith('04')) {
// 防止上报两次 群聊戳一戳
if (PokeCache.has(peeruid)) {
log('[群聊] 群组 ', peeruin, ' 戳一戳');
pokeEvent = new OB11GroupPokeEvent(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(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)) {
// log('[群聊] 群组 ', peeruin, ' 戳一戳');
// pokeEvent = new OB11GroupPokeEvent(peeruin);
// postOB11Event(pokeEvent);
// }
// PokeCache.set(peeruid, false);
// setTimeout(() => {
// PokeCache.delete(peeruid);
// }, 1000);
// }
if (MsgType == 528 && subType0 == 349) {
const sysDeviceMsg = DeviceData.fromBinary(Buffer.from(protobufData));
DeviceList = [];
@@ -332,6 +332,7 @@ export class NapCatOnebot11 {
postOB11Event(msg);
// log("post msg", msg)
}).catch(e => logError('constructMessage error: ', e));
await OB11Constructor.GroupEvent(message);
OB11Constructor.GroupEvent(message).then(groupEvent => {
if (groupEvent) {
// log("post group event", groupEvent);