From 4b6cde786e64ce3f7d0ddaec57c9c1b66469699b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Wed, 7 Aug 2024 09:39:23 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/nwebui/Readme.md | 4 ++++ src/onebot11/action/extends/Config.ts | 20 ------------------- .../action/go-cqhttp/GetForwardMsg.ts | 10 +++++----- src/onebot11/config.ts | 8 +------- 4 files changed, 10 insertions(+), 32 deletions(-) create mode 100644 src/nwebui/Readme.md delete mode 100644 src/onebot11/action/extends/Config.ts diff --git a/src/nwebui/Readme.md b/src/nwebui/Readme.md new file mode 100644 index 00000000..327e59ea --- /dev/null +++ b/src/nwebui/Readme.md @@ -0,0 +1,4 @@ +# NewWebui +基于Vue3实现的现代化轻量化NapCat管理面板 +## 进度 +画饼 \ No newline at end of file diff --git a/src/onebot11/action/extends/Config.ts b/src/onebot11/action/extends/Config.ts deleted file mode 100644 index a847ae27..00000000 --- a/src/onebot11/action/extends/Config.ts +++ /dev/null @@ -1,20 +0,0 @@ -import BaseAction from '../BaseAction'; -import { OB11Config, ob11Config } from '@/onebot11/config'; -import { ActionName } from '../types'; - - -export class GetConfigAction extends BaseAction { - actionName = ActionName.GetConfig; - - protected async _handle(payload: null): Promise { - return ob11Config; - } -} - -export class SetConfigAction extends BaseAction { - actionName = ActionName.SetConfig; - - protected async _handle(payload: OB11Config): Promise { - ob11Config.save(payload, true); - } -} diff --git a/src/onebot11/action/go-cqhttp/GetForwardMsg.ts b/src/onebot11/action/go-cqhttp/GetForwardMsg.ts index bbe10153..52665f82 100644 --- a/src/onebot11/action/go-cqhttp/GetForwardMsg.ts +++ b/src/onebot11/action/go-cqhttp/GetForwardMsg.ts @@ -24,12 +24,12 @@ export class GoCQHTTPGetForwardMsgAction extends BaseAction { actionName = ActionName.GoCQHTTP_GetForwardMsg; PayloadSchema = SchemaData; protected async _handle(payload: Payload): Promise { - const msgId = payload.message_id || payload.id; - if (!msgId) { - throw Error('message_id is required'); + const msgIdMixOb11Id = payload.message_id || payload.id; + if (!msgIdMixOb11Id) { + throw Error('message_id or id is required'); } - const rootMsgId = MessageUnique.getShortIdByMsgId(msgId); - const rootMsg = MessageUnique.getMsgIdAndPeerByShortId(rootMsgId || parseInt(msgId)); + const rootMsgId = MessageUnique.getShortIdByMsgId(msgIdMixOb11Id); + const rootMsg = MessageUnique.getMsgIdAndPeerByShortId(rootMsgId || parseInt(msgIdMixOb11Id)); if (!rootMsg) { throw Error('msg not found'); } diff --git a/src/onebot11/config.ts b/src/onebot11/config.ts index 9ff7b4e9..3a3c5480 100644 --- a/src/onebot11/config.ts +++ b/src/onebot11/config.ts @@ -1,10 +1,4 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import { selfInfo } from '@/core/data'; -import { logDebug, logError } from '@/common/utils/log'; import { ConfigBase } from '@/common/utils/ConfigBase'; -import { json } from 'stream/consumers'; - export interface OB11Config { http: { enable: boolean; @@ -36,7 +30,7 @@ export interface OB11Config { Record: boolean, RecordList: Array }, - read(): OB11Config; + read(): OB11Config | null; save(config: OB11Config): void; }