From 31eee4c8cab16f83a8f1e4a694e30dcb1fcbdfa0 Mon Sep 17 00:00:00 2001 From: Ctrlcvs <1509167646@qq.com> Date: Mon, 31 Oct 2022 14:14:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E9=89=B4=E8=AE=BE=E7=BD=AE=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Note.js | 24 +++++++++++++++--------- apps/admin.js | 5 +++-- resources/admin/index.html | 14 +++++++++++++- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/apps/Note.js b/apps/Note.js index 51c5d2d..5d31423 100644 --- a/apps/Note.js +++ b/apps/Note.js @@ -412,7 +412,11 @@ export async function Note_appoint(e) { let type = 0; if (msg.includes("列表")) { let isUser= msg.includes('我的') - let temp =tempData[e.user_id]["temp"]; + let temp =tempData[e.user_id]?.temp; + if(!temp&&isUser){ + e.reply("未获取到您设置的模板信息哦~") + return true; + } let xlmsg = msg.replace(/列表|我的/g, "") * 1 || 1 let listLength=isUser?temp.length:keyType.length let sumCount = (listLength / 80 + 0.49).toFixed(0); @@ -501,25 +505,27 @@ const note_file = function(xiaoyao) { let url2 = `./plugins/xiaoyao-cvs-plugin/resources/BJT-Templet/` //冤种情况。。 let url3 = `./plugins/xiaoyao-cvs-plugin/resources/dailyNote/background_image/` var urlFile = fs.readdirSync(url1); - var bJTurlFile = fs.readdirSync(url2); var urlType = {}; for (let val of urlFile) { if (val.includes(".")) continue; urlType[val] = url1 + val } - for (let val of bJTurlFile) { - if (!val.includes("Template")) continue; - let file = fs.readdirSync(`${url2}${val}`); - for (let va of file) { - if (va.includes(".")) continue; - urlType[va] = url2 + val + "/" + va + if (fs.existsSync(url2)) { + var bJTurlFile = fs.readdirSync(url2); + for (let val of bJTurlFile) { + if (!val.includes("Template")) continue; + let file = fs.readdirSync(`${url2}${val}`); + for (let va of file) { + if (va.includes(".")) continue; + urlType[va] = url2 + val + "/" + va + } } } if (!xiaoyao) { var urlFileOne = fs.readdirSync(url3); for (let val of urlFileOne) { if (!val.includes(".")) continue; - urlType[val] = url3 + "background_image/" + val + urlType[val] = url3 + val } } return urlType; diff --git a/apps/admin.js b/apps/admin.js index bf8d42d..313929c 100644 --- a/apps/admin.js +++ b/apps/admin.js @@ -53,7 +53,7 @@ export const rule = { const _path = process.cwd(); const resPath = `${_path}/plugins/xiaoyao-cvs-plugin/resources/`; const plusPath = `${resPath}/xiaoyao-plus/`; - +const notePlus=`${resPath}/BJT-Templet/`; export async function sysCfg(e, { render }) { @@ -92,8 +92,9 @@ export async function sysCfg(e, { Note: getStatus("sys.Note",false), Atlas: getStatus("sys.Atlas",false), len:Cfg.get("mb.len", 0), - poke: getStatus("note.poke",false), + poke: getStatus("note.poke",false), imgPlus: fs.existsSync(plusPath), + notePlus: fs.existsSync(notePlus), bg: await rodom(), //获取底图 Atlasall:getStatus("Atlas.all",false), } diff --git a/resources/admin/index.html b/resources/admin/index.html index ef7ff91..6de3c09 100644 --- a/resources/admin/index.html +++ b/resources/admin/index.html @@ -72,7 +72,7 @@