From a0cea819dae77cbf720ba095a122ca4c32bf20a5 Mon Sep 17 00:00:00 2001 From: Nepenthe Date: Sat, 20 Jul 2024 14:51:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=A4=E6=88=B3=E4=B8=80=E6=88=B3=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8E=9F=E5=A7=8B=E4=BF=A1=E6=81=AF=20=E7=BE=A4?= =?UTF-8?q?=E6=B6=88=E6=81=AFlog=E5=A2=9E=E5=8A=A0=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/onebot11/constructor.ts | 9 ++++----- src/onebot11/event/notice/OB11PokeEvent.ts | 4 +++- src/onebot11/log.ts | 3 +++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/onebot11/constructor.ts b/src/onebot11/constructor.ts index 9234d1a1..b165215d 100644 --- a/src/onebot11/constructor.ts +++ b/src/onebot11/constructor.ts @@ -477,12 +477,11 @@ export class OB11Constructor { if (grayTipElement.jsonGrayTipElement.busiId == 1061) { //判断业务类型 //Poke事件 - let pokedetail: any[] = json.items; + const 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)); - if (pokedetail.length == 2) { - return new OB11GroupPokeEvent(parseInt(msg.peerUid), parseInt((await NTQQUserApi.getUinByUid(pokedetail[0].uid))!), parseInt((await NTQQUserApi.getUinByUid(pokedetail[1].uid))!)); + const poke_uid = pokedetail.filter(item => item.uid); + if (poke_uid.length == 2) { + return new OB11GroupPokeEvent(parseInt(msg.peerUid), parseInt((await NTQQUserApi.getUinByUid(poke_uid[0].uid))!), parseInt((await NTQQUserApi.getUinByUid(poke_uid[1].uid))!), pokedetail); } } if (grayTipElement.jsonGrayTipElement.busiId == 2401) { diff --git a/src/onebot11/event/notice/OB11PokeEvent.ts b/src/onebot11/event/notice/OB11PokeEvent.ts index 2e64cbac..5b965005 100644 --- a/src/onebot11/event/notice/OB11PokeEvent.ts +++ b/src/onebot11/event/notice/OB11PokeEvent.ts @@ -19,11 +19,13 @@ export class OB11FriendPokeEvent extends OB11PokeEvent { export class OB11GroupPokeEvent extends OB11PokeEvent { group_id: number; + raw_message: any; - constructor(group_id: number, user_id: number = 0, target_id: number = 0,) { + constructor(group_id: number, user_id: number = 0, target_id: number = 0, raw_message: any) { super(); this.group_id = group_id; this.target_id = target_id; this.user_id = user_id; + this.raw_message = raw_message; } } diff --git a/src/onebot11/log.ts b/src/onebot11/log.ts index e1e8f3e3..d92c0f53 100644 --- a/src/onebot11/log.ts +++ b/src/onebot11/log.ts @@ -63,6 +63,9 @@ export async function logMessage(ob11Message: OB11Message) { else if (segment.type === 'markdown') { msgParts.push(spSegColor(`[markdown|${segment.data.content}]`)); } + else if (segment.type === 'video') { + msgParts.push(spSegColor(`[视频|${segment.data.url}]`)); + } else { msgParts.push(spSegColor(`[未实现|${JSON.stringify(segment)}]`)); }