From b3cae5f1c671541cf6f37bfc614109db3c017345 Mon Sep 17 00:00:00 2001 From: linyuchen Date: Sun, 4 Feb 2024 10:00:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=BC=80=E5=85=B3?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E6=98=AF=E5=90=A6=E4=B8=8A=E6=8A=A5=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E5=8F=91=E9=80=81=E7=9A=84=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/types.ts | 1 + src/renderer.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/common/types.ts b/src/common/types.ts index 3e5a094..f1106c0 100644 --- a/src/common/types.ts +++ b/src/common/types.ts @@ -186,6 +186,7 @@ export interface Config { enableBase64?: boolean debug?: boolean log?: boolean + reportSelfMessage?: boolean } export interface SendMsgResult { diff --git a/src/renderer.ts b/src/renderer.ts index d080e15..79eba40 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -124,6 +124,7 @@ async function getGroupMember(group_qq: string, member_uid: string) { } async function handleNewMessage(messages: MessageElement[]) { + const {reportSelfMessage} = await window.llonebot.getConfig(); console.log("llonebot 收到消息:", messages); const {debug, enableBase64} = await window.llonebot.getConfig(); for (let message of messages) { @@ -144,6 +145,7 @@ async function handleNewMessage(messages: MessageElement[]) { raw_message: "", font: 14 } + if (debug) { onebot_message_data.raw = JSON.parse(JSON.stringify(message)) } @@ -244,6 +246,9 @@ async function handleNewMessage(messages: MessageElement[]) { msgHistory.splice(0, 100) } msgHistory.push(message) + if (!reportSelfMessage && onebot_message_data?.user_id == self_qq) { + continue; + } console.log("发送上传消息给ipc main", onebot_message_data) window.llonebot.postData(onebot_message_data); } @@ -624,6 +629,12 @@ async function onSettingWindowCreated(view: Element) { + +
+
上报自己发送的消息
+
+ +
日志
@@ -631,6 +642,7 @@ async function onSettingWindowCreated(view: Element) {
+ @@ -680,6 +692,7 @@ async function onSettingWindowCreated(view: Element) { switchClick("debug", "debug"); switchClick("switchBase64", "enableBase64"); switchClick("log", "log"); + switchClick("sendSelf", "sendSelf"); doc.getElementById("save")?.addEventListener("click", () => {