diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 0790e0b..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Bug反馈 -about: 报个Bug -title: '' -labels: bug -assignees: '' - ---- - -QQ版本: - -LLOneBot版本: - -调用LLOneBot的方式或者应用端(如postman直接调用,或NoneBot2、Koishi): - -BUG描述: - -复现步骤: - -LLOneBot日志: \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 0000000..e8ca336 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,81 @@ +name: Bug 反馈 +description: 报告可能的 LLOneBot 异常行为 +title: '[BUG] ' +labels: bug +body: + - type: markdown + attributes: + value: | + 欢迎来到 LLOneBot 的 Issue Tracker!请填写以下表格来提交 Bug。 + 在提交新的 Bug 反馈前,请确保您: + * 已经搜索了现有的 issues,并且没有找到可以解决您问题的方法 + * 不与现有的某一 issue 重复 + - type: input + id: system-version + attributes: + label: 系统版本 + description: 运行 QQNT 的系统版本 + placeholder: Windows 10 Pro Workstation 22H2 + validations: + required: true + - type: input + id: qqnt-version + attributes: + label: QQNT 版本 + description: 可在 QQNT 的「关于」或是在 LiteLoaderQQNT 的设置页中找到 + placeholder: 9.9.7-21804 + validations: + required: true + - type: input + id: llonebot-version + attributes: + label: LLOneBot 版本 + description: 可在 LiteLoaderQQNT 的设置页或是 QQNT 的设置页侧栏中找到 + placeholder: 3.18.0 + validations: + required: true + - type: input + id: onebot-client-version + attributes: + label: OneBot 客户端 + description: 连接至 LLOneBot 的客户端版本信息 + placeholder: Overflow 2.16.0-2cf7991-SNAPSHOT + validations: + required: true + - type: textarea + id: what-happened + attributes: + label: 发生了什么? + description: 填写你认为的 LLOneBot 的不正常行为 + validations: + required: true + - type: textarea + id: how-reproduce + attributes: + label: 如何复现 + description: 填写应当如何操作才能触发这个不正常行为 + placeholder: | + 1. xxx + 2. xxx + 3. xxx + validations: + required: true + - type: textarea + id: what-expected + attributes: + label: 期望的结果? + description: 填写你认为 LLOneBot 应当执行的正常行为 + validations: + required: true + - type: textarea + id: llonebot-log + attributes: + label: LLOneBot 运行日志 + description: 在 LLOneBot 的设置页中打开「写入日志」然后粘贴相关日志内容到此处 + render: shell + - type: textarea + id: onebot-client-log + attributes: + label: OneBot 客户端运行日志 + description: 粘贴 OneBot 客户端的相关日志内容到此处 + render: shell \ No newline at end of file diff --git a/manifest.json b/manifest.json index 6c6b0ce..c0ef1e9 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { "manifest_version": 4, "type": "extension", - "name": "LLOneBot v3.18.0", + "name": "LLOneBot v3.18.3", "slug": "LLOneBot", "description": "LiteLoaderQQNT的OneBotApi,不支持商店在线更新", - "version": "3.18.0", + "version": "3.18.3", "icon": "./icon.jpg", "authors": [ { diff --git a/src/main/main.ts b/src/main/main.ts index a83ca1e..ebc1ee2 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -49,11 +49,13 @@ import {checkFfmpeg} from "../common/utils/video"; let running = false; +let mainWindow: BrowserWindow | null = null; // 加载插件时触发 function onLoad() { log("llonebot main onLoad"); ipcMain.handle(CHANNEL_CHECK_VERSION, async (event, arg) => { + return checkNewVersion(); }); ipcMain.handle(CHANNEL_UPDATE, async (event, arg) => { @@ -105,8 +107,26 @@ function onLoad() { const config = getConfigUtil().getConfig() return config; }) - ipcMain.on(CHANNEL_SET_CONFIG, (event, config: Config) => { - setConfig(config).then(); + ipcMain.on(CHANNEL_SET_CONFIG, (event, ask:boolean, config: Config) => { + if (!ask){ + setConfig(config).then(); + return + } + dialog.showMessageBox(mainWindow, { + type: 'question', + buttons: ['确认', '取消'], + defaultId: 0, // 默认选中的按钮,0 代表第一个按钮,即 "确认" + title: '确认保存', + message: '是否保存?', + detail: 'LLOneBot配置已更改,是否保存?' + }).then(result => { + if (result.response === 0) { + setConfig(config).then(); + } else { + } + }).catch(err => { + log("保存设置询问弹窗错误", err); + }); }) ipcMain.on(CHANNEL_LOG, (event, arg) => { @@ -402,6 +422,7 @@ function onBrowserWindowCreated(window: BrowserWindow) { if (selfInfo.uid) { return } + mainWindow = window; log("window create", window.webContents.getURL().toString()) try { hookNTQQApiCall(window); @@ -417,6 +438,7 @@ try { console.log(e.toString()) } + // 这两个函数都是可选的 export { onBrowserWindowCreated diff --git a/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts b/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts index 15e0557..3ac98ae 100644 --- a/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts +++ b/src/onebot11/action/go-cqhttp/GetGroupMsgHistory.ts @@ -15,21 +15,25 @@ interface Payload { count: number } -export default class GoCQHTTPGetGroupMsgHistory extends BaseAction { +interface Response{ + messages: OB11Message[] +} + +export default class GoCQHTTPGetGroupMsgHistory extends BaseAction { actionName = ActionName.GoCQHTTP_GetGroupMsgHistory - protected async _handle(payload: Payload): Promise { + protected async _handle(payload: Payload): Promise { const group = groups.find(group => group.groupCode === payload.group_id.toString()) if (!group) { throw `群${payload.group_id}不存在` } const startMsgId = (await dbUtil.getMsgByShortId(payload.message_seq))?.msgId || "0" // log("startMsgId", startMsgId) - let msgList = (await NTQQMsgApi.getMsgHistory({chatType: ChatType.group, peerUid: group.groupCode}, startMsgId, parseInt(payload.count.toString()) || 0)).msgList + let msgList = (await NTQQMsgApi.getMsgHistory({chatType: ChatType.group, peerUid: group.groupCode}, startMsgId, parseInt(payload.count?.toString()) || 20)).msgList await Promise.all(msgList.map(async msg => { msg.msgShortId = await dbUtil.addMsg(msg) })) const ob11MsgList = await Promise.all(msgList.map(msg=>OB11Constructor.message(msg))) - return ob11MsgList + return {"messages": ob11MsgList} } } \ No newline at end of file diff --git a/src/preload.ts b/src/preload.ts index bc3134e..bfd8cac 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -24,8 +24,8 @@ const llonebot = { updateLLOneBot:async (): Promise => { return ipcRenderer.invoke(CHANNEL_UPDATE); }, - setConfig: (config: Config) => { - ipcRenderer.send(CHANNEL_SET_CONFIG, config); + setConfig: (ask: boolean, config: Config) => { + ipcRenderer.send(CHANNEL_SET_CONFIG, ask, config); }, getConfig: async (): Promise => { return ipcRenderer.invoke(CHANNEL_GET_CONFIG); diff --git a/src/renderer/index.ts b/src/renderer/index.ts index 52b37f9..ea48e2e 100644 --- a/src/renderer/index.ts +++ b/src/renderer/index.ts @@ -21,7 +21,7 @@ async function onSettingWindowCreated(view: Element) { else config[key] = value; if (!['heartInterval', 'token', 'ffmpeg'].includes(key)) { - window.llonebot.setConfig(config); + window.llonebot.setConfig(false, config); } } }; @@ -324,7 +324,7 @@ async function onSettingWindowCreated(view: Element) { doc.querySelector('#config-ob11-save').addEventListener('click', () => { config.ob11 = ob11Config; - window.llonebot.setConfig(config); + window.llonebot.setConfig(false, config); // window.location.reload(); showError().then() alert('保存成功'); @@ -363,8 +363,14 @@ async function onSettingWindowCreated(view: Element) { } view.querySelector(".llonebot-update-button").addEventListener("click", update); } - }; + } window.llonebot.checkVersion().then(checkVersionFunc); + window.addEventListener('beforeunload', (event) => { + if (JSON.stringify(ob11Config) === JSON.stringify(config.ob11)) return; + config.ob11 = ob11Config; + window.llonebot.setConfig(true, config); + + }); } diff --git a/src/version.ts b/src/version.ts index 2a351de..6c4c443 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const version = "3.18.0" \ No newline at end of file +export const version = "3.18.3" \ No newline at end of file