mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
Merge branch 'dev'
# Conflicts: # src/renderer.ts
This commit is contained in:
commit
5e00aee176
@ -1,6 +1,5 @@
|
|||||||
# LLOneBot API
|
# LLOneBot API
|
||||||
|
|
||||||
|
|
||||||
将NTQQLiteLoaderAPI封装成OneBot11/12标准的API, V12没有完整测试
|
将NTQQLiteLoaderAPI封装成OneBot11/12标准的API, V12没有完整测试
|
||||||
|
|
||||||
*注意:本文档对应的是 LiteLoader 1.0.0及以上版本,如果你使用的是旧版本请切换到本项目v1分支查看文档*
|
*注意:本文档对应的是 LiteLoader 1.0.0及以上版本,如果你使用的是旧版本请切换到本项目v1分支查看文档*
|
||||||
|
@ -185,6 +185,7 @@ export interface Config {
|
|||||||
hosts: string[]
|
hosts: string[]
|
||||||
enableBase64?: boolean
|
enableBase64?: boolean
|
||||||
debug?: boolean
|
debug?: boolean
|
||||||
|
reportSelfMessage?: boolean
|
||||||
log?: boolean
|
log?: boolean
|
||||||
reportSelfMessage?: boolean
|
reportSelfMessage?: boolean
|
||||||
}
|
}
|
||||||
|
@ -124,9 +124,8 @@ 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, reportSelfMessage} = await window.llonebot.getConfig();
|
||||||
for (let message of messages) {
|
for (let message of messages) {
|
||||||
let onebot_message_data: any = {
|
let onebot_message_data: any = {
|
||||||
self: {
|
self: {
|
||||||
@ -145,7 +144,6 @@ 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))
|
||||||
}
|
}
|
||||||
@ -246,11 +244,12 @@ 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) {
|
if (!reportSelfMessage && onebot_message_data["user_id"] == self_qq){
|
||||||
continue;
|
console.log("开启了不上传自己发送的消息,进行拦截 ", onebot_message_data);
|
||||||
|
} else {
|
||||||
|
console.log("发送上传消息给ipc main", onebot_message_data);
|
||||||
|
window.llonebot.postData(onebot_message_data);
|
||||||
}
|
}
|
||||||
console.log("发送上传消息给ipc main", onebot_message_data)
|
|
||||||
window.llonebot.postData(onebot_message_data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,9 +630,10 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
</setting-item>
|
</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>
|
||||||
|
<div class="tips">开启后上报自己发出的消息</div>
|
||||||
</div>
|
</div>
|
||||||
<setting-switch id="sendSelf" ${config.reportSelfMessage ? "is-active" : ""}></setting-switch>
|
<setting-switch id="reportSelfMessage" ${config.reportSelfMessage ? "is-active" : ""}></setting-switch>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
<setting-item data-direction="row" class="hostItem vertical-list-item">
|
<setting-item data-direction="row" class="hostItem vertical-list-item">
|
||||||
<div>
|
<div>
|
||||||
@ -642,7 +642,6 @@ 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>
|
||||||
@ -691,8 +690,8 @@ async function onSettingWindowCreated(view: Element) {
|
|||||||
|
|
||||||
switchClick("debug", "debug");
|
switchClick("debug", "debug");
|
||||||
switchClick("switchBase64", "enableBase64");
|
switchClick("switchBase64", "enableBase64");
|
||||||
|
switchClick("reportSelfMessage", "reportSelfMessage");
|
||||||
switchClick("log", "log");
|
switchClick("log", "log");
|
||||||
switchClick("sendSelf", "sendSelf");
|
|
||||||
|
|
||||||
doc.getElementById("save")?.addEventListener("click",
|
doc.getElementById("save")?.addEventListener("click",
|
||||||
() => {
|
() => {
|
||||||
@ -726,4 +725,4 @@ setTimeout(onLoad, 5000)
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
onSettingWindowCreated
|
onSettingWindowCreated
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user