Compare commits

..

14 Commits

Author SHA1 Message Date
linyuchen
b830cfbfa0 style: syntax error 2024-02-04 10:34:57 +08:00
linyuchen
ce25c9752f ver: 2.4.0 2024-02-04 10:29:50 +08:00
linyuchen
5e00aee176 Merge branch 'dev'
# Conflicts:
#	src/renderer.ts
2024-02-04 10:29:10 +08:00
linyuchen
a25c1b24fc feat: 新增开关控制是否上报自己发送的消息 2024-02-04 10:26:20 +08:00
linyuchen
afed1b8575 Merge pull request #22 from YuChuXi/dev_report
添加上报自身消息设置项
2024-02-04 10:05:25 +08:00
linyuchen
0fe58c1965 Merge branch 'dev' into dev_report 2024-02-04 10:05:02 +08:00
linyuchen
b3cae5f1c6 feat: 新增开关控制是否上报自己发送的消息 2024-02-04 10:00:13 +08:00
YuChuXi
d09fc78747 改了文本 2024-02-04 03:04:02 +08:00
YuChuXi
19d7ecd4f0 新增设置项:上报自身消息 2024-02-04 02:54:56 +08:00
linyuchen
070eee6c1c docs: README update 2024-02-03 19:31:22 +08:00
linyuchen
fe5e0ea4e0 Merge remote-tracking branch 'origin/main' 2024-02-03 19:29:08 +08:00
linyuchen
a249139fe0 Update README.md 2024-02-03 16:08:57 +08:00
linyuchen
3d03aec976 fix: 偶尔出现不能上报 2024-02-02 21:54:31 +08:00
linyuchen
083d3ddf67 docs: update 2024-01-31 19:29:25 +08:00
4 changed files with 19 additions and 23 deletions

View File

@@ -1,6 +1,5 @@
# LLOneBot API
将NTQQLiteLoaderAPI封装成OneBot11/12标准的API, V12没有完整测试
*注意:本文档对应的是 LiteLoader 1.0.0及以上版本如果你使用的是旧版本请切换到本项目v1分支查看文档*
@@ -105,24 +104,11 @@
</details>
<br/>
<details>
<summary>撤回消息无效</summary>
<br/>
如果接口调用的传的`message`是number类型会导致精度丢失使用string类型可解决详情见<a href="https://github.com/linyuchen/LiteLoaderQQNT-OneBotApi/issues/17">issue#17</a>
</details>
<br/>
<details>
<summary>如何查看日志</summary>
<br/>
LiteLoaderQQNT/data/LLOneBot/*.log
</details>
<br/>
## TODO
- [x] 接口返回更详细的错误信息,目前消息发不出去也会返回发送成功(这河里吗)
- [ ] 转发消息记录
- [ ] 好友点赞api
- [ ] 支持websocket等个有缘人提PR实现
- [ ] 重构摆脱LLAPI目前调用LLAPI只能在renderer进程调用需重构成在main进程调用

View File

@@ -4,7 +4,7 @@
"name": "LLOneBot",
"slug": "LLOneBot",
"description": "LiteLoaderQQNT的OneBotApi",
"version": "2.3.0",
"version": "2.4.0",
"thumbnail": "./icon.png",
"authors": [{
"name": "linyuchen",

View File

@@ -185,6 +185,7 @@ export interface Config {
hosts: string[]
enableBase64?: boolean
debug?: boolean
reportSelfMessage?: boolean
log?: boolean
}

View File

@@ -1,7 +1,5 @@
/// <reference path="./global.d.ts" />
// import express from "express";
// const { ipcRenderer } = require('electron');
import {
AtType,
ChatType,
@@ -13,7 +11,6 @@ import {
SendMsgResult,
User
} from "./common/types";
import {checkFileReceived} from "./main/utils";
let self_qq: string = ""
let groups: Group[] = []
@@ -125,7 +122,7 @@ async function getGroupMember(group_qq: string, member_uid: string) {
async function handleNewMessage(messages: MessageElement[]) {
console.log("llonebot 收到消息:", messages);
const {debug, enableBase64} = await window.llonebot.getConfig();
const {debug, enableBase64, reportSelfMessage} = await window.llonebot.getConfig();
for (let message of messages) {
let onebot_message_data: any = {
self: {
@@ -244,8 +241,12 @@ async function handleNewMessage(messages: MessageElement[]) {
msgHistory.splice(0, 100)
}
msgHistory.push(message)
console.log("发送上传消息给ipc main", onebot_message_data)
window.llonebot.postData(onebot_message_data);
if (!reportSelfMessage && onebot_message_data["user_id"] == self_qq){
console.log("开启了不上传自己发送的消息,进行拦截 ", onebot_message_data);
} else {
console.log("发送上传消息给ipc main", onebot_message_data);
window.llonebot.postData(onebot_message_data);
}
}
}
@@ -624,6 +625,13 @@ async function onSettingWindowCreated(view: Element) {
</div>
<setting-switch id="debug" ${config.debug ? "is-active" : ""}></setting-switch>
</setting-item>
<setting-item data-direction="row" class="hostItem vertical-list-item">
<div>
<div>上报自身消息</div>
<div class="tips">开启后上报自己发出的消息</div>
</div>
<setting-switch id="reportSelfMessage" ${config.reportSelfMessage ? "is-active" : ""}></setting-switch>
</setting-item>
<setting-item data-direction="row" class="hostItem vertical-list-item">
<div>
<div>日志</div>
@@ -679,6 +687,7 @@ async function onSettingWindowCreated(view: Element) {
switchClick("debug", "debug");
switchClick("switchBase64", "enableBase64");
switchClick("reportSelfMessage", "reportSelfMessage");
switchClick("log", "log");
doc.getElementById("save")?.addEventListener("click",
@@ -713,4 +722,4 @@ setTimeout(onLoad, 5000)
export {
onSettingWindowCreated
}
}