mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat: 新增开关控制是否上报自己发送的消息
This commit is contained in:
parent
070eee6c1c
commit
b3cae5f1c6
@ -186,6 +186,7 @@ export interface Config {
|
|||||||
enableBase64?: boolean
|
enableBase64?: boolean
|
||||||
debug?: boolean
|
debug?: boolean
|
||||||
log?: boolean
|
log?: boolean
|
||||||
|
reportSelfMessage?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SendMsgResult {
|
export interface SendMsgResult {
|
||||||
|
@ -124,6 +124,7 @@ async function getGroupMember(group_qq: string, member_uid: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleNewMessage(messages: MessageElement[]) {
|
async function handleNewMessage(messages: MessageElement[]) {
|
||||||
|
const {reportSelfMessage} = await window.llonebot.getConfig();
|
||||||
console.log("llonebot 收到消息:", messages);
|
console.log("llonebot 收到消息:", messages);
|
||||||
const {debug, enableBase64} = await window.llonebot.getConfig();
|
const {debug, enableBase64} = await window.llonebot.getConfig();
|
||||||
for (let message of messages) {
|
for (let message of messages) {
|
||||||
@ -144,6 +145,7 @@ async function handleNewMessage(messages: MessageElement[]) {
|
|||||||
raw_message: "",
|
raw_message: "",
|
||||||
font: 14
|
font: 14
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
onebot_message_data.raw = JSON.parse(JSON.stringify(message))
|
onebot_message_data.raw = JSON.parse(JSON.stringify(message))
|
||||||
}
|
}
|
||||||
@ -244,6 +246,9 @@ async function handleNewMessage(messages: MessageElement[]) {
|
|||||||
msgHistory.splice(0, 100)
|
msgHistory.splice(0, 100)
|
||||||
}
|
}
|
||||||
msgHistory.push(message)
|
msgHistory.push(message)
|
||||||
|
if (!reportSelfMessage && onebot_message_data?.user_id == self_qq) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
console.log("发送上传消息给ipc main", onebot_message_data)
|
console.log("发送上传消息给ipc main", onebot_message_data)
|
||||||
window.llonebot.postData(onebot_message_data);
|
window.llonebot.postData(onebot_message_data);
|
||||||
}
|
}
|
||||||
@ -624,6 +629,12 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
</div>
|
</div>
|
||||||
<setting-switch id="debug" ${config.debug ? "is-active" : ""}></setting-switch>
|
<setting-switch id="debug" ${config.debug ? "is-active" : ""}></setting-switch>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
|
<setting-item data-direction="row" class="hostItem vertical-list-item">
|
||||||
|
<div>
|
||||||
|
<div>上报自己发送的消息</div>
|
||||||
|
</div>
|
||||||
|
<setting-switch id="sendSelf" ${config.reportSelfMessage ? "is-active" : ""}></setting-switch>
|
||||||
|
</setting-item>
|
||||||
<setting-item data-direction="row" class="hostItem vertical-list-item">
|
<setting-item data-direction="row" class="hostItem vertical-list-item">
|
||||||
<div>
|
<div>
|
||||||
<div>日志</div>
|
<div>日志</div>
|
||||||
@ -631,6 +642,7 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
</div>
|
</div>
|
||||||
<setting-switch id="log" ${config.log ? "is-active" : ""}></setting-switch>
|
<setting-switch id="log" ${config.log ? "is-active" : ""}></setting-switch>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
|
|
||||||
</setting-panel>
|
</setting-panel>
|
||||||
</setting-section>
|
</setting-section>
|
||||||
</div>
|
</div>
|
||||||
@ -680,6 +692,7 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
switchClick("debug", "debug");
|
switchClick("debug", "debug");
|
||||||
switchClick("switchBase64", "enableBase64");
|
switchClick("switchBase64", "enableBase64");
|
||||||
switchClick("log", "log");
|
switchClick("log", "log");
|
||||||
|
switchClick("sendSelf", "sendSelf");
|
||||||
|
|
||||||
doc.getElementById("save")?.addEventListener("click",
|
doc.getElementById("save")?.addEventListener("click",
|
||||||
() => {
|
() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user