diff --git a/apps/Note.js b/apps/Note.js index 343daf4..d1ff779 100644 --- a/apps/Note.js +++ b/apps/Note.js @@ -24,7 +24,7 @@ const _path = process.cwd(); export async function Note(e, { render }) { - if(!Cfg.get("sys.Note")){ + if (!Cfg.get("sys.Note")) { return false; } let cookie, uid; @@ -110,26 +110,24 @@ export async function Note(e, { resinMaxTime = ` ${resinMaxTime}`; } } - + for (let val of data.expeditions) { + val.remained_time = new Date().getTime() + val.remained_time * 1000; + let remainedDate = new Date(val.remained_time); + val.remained_time = format("hh:mm", remainedDate); + if (format("dd", remainedDate) != nowDay) { + val.remained_time = `明天 ${val.remained_time}`; + } else { + val.remained_time = ` ${val.remained_time}`; + } + } let remained_time = ""; if (data.expeditions && data.expeditions.length >= 1) { remained_time = lodash.map(data.expeditions, "remained_time"); remained_time = lodash.min(remained_time); if (remained_time > 0) { - for (let val of data.expeditions) { - val.remained_time = new Date().getTime() + val.remained_time * 1000; - let remainedDate = new Date(val.remained_time); - val.remained_time = format("hh:mm", remainedDate); - if (format("dd", remainedDate) != nowDay) { - val.remained_time = `明天 ${val.remained_time}`; - } else { - val.remained_time = ` ${val.remained_time}`; - } - } remained_time = new Date().getTime() + remained_time * 1000; let remainedDate = new Date(remained_time); remained_time = format("hh:mm", remainedDate); - if (format("dd", remainedDate) != nowDay) { remained_time = `明天 ${remained_time}`; } else { @@ -158,7 +156,7 @@ export async function Note(e, { let day = format("MM-dd hh:mm", new Date()); let week = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; day += " " + week[new Date().getDay()]; - + //参量质变仪 if (data?.transformer?.obtained) { data.transformer.reached = data.transformer.recovery_time.reached; @@ -175,12 +173,12 @@ export async function Note(e, { } data.transformer.recovery_time = recovery_time; } - var image= fs.readdirSync(`./plugins/xiaoyao-cvs-plugin/resources/dailyNote/background_image`); - var list_img=[]; + var image = fs.readdirSync(`./plugins/xiaoyao-cvs-plugin/resources/dailyNote/background_image`); + var list_img = []; for (let val of image) { list_img.push(val) } - var imgs=list_img[lodash.random(0, list_img.length-1)]; + var imgs =list_img.length==1?list_img.length[0]:list_img[lodash.random(0, list_img.length - 1)]; return await Common.render("dailyNote/dailyNote", { save_id: uid, uid: uid, diff --git a/apps/xiaoyao_image.js b/apps/xiaoyao_image.js index c6ea1e0..21df62e 100644 --- a/apps/xiaoyao_image.js +++ b/apps/xiaoyao_image.js @@ -15,7 +15,7 @@ export async function AtlasAlias(e) { // if (await foodInfo(e)) return true; if (await RelicsInfo(e)) return true; // if (await monsterInfo(e)) return true; - var name = e.msg.replace(/#|#|信息|图鉴|命座|天赋|突破|圣遗物|原魔|食物|食材|的|特殊|材|料|特色|料理|理|色/g, ""); + var name = e.msg.replace(/#|#|信息|图鉴|命座|天赋|突破|圣遗物|食物|食材|的|特殊|材|料|特色|料理|理|色/g, ""); send_Msg(e, "all", name) return true; } @@ -41,6 +41,11 @@ export async function roleInfo(e) { } const send_Msg = function(e, type, name) { + let path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${type}/${name}.png` + if (fs.existsSync(path)) { + e.reply(segment.image(`file:///${path}`)); + return true; + } if (type == "all") { for (let val of list) { let new_name = info_img(e, Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/Atlas_alias/`, @@ -52,7 +57,7 @@ const send_Msg = function(e, type, name) { } } } - let path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${type}/${name}.png` + path = `${_path}/plugins/xiaoyao-cvs-plugin/resources/xiaoyao-plus/${type}/${name}.png` if (!fs.existsSync(path)) { return true; } diff --git a/components/Common.js b/components/Common.js index e93c82f..54d5a9d 100644 --- a/components/Common.js +++ b/components/Common.js @@ -15,7 +15,7 @@ export const render = async function (path, params, cfg) { scale: Cfg.scale(cfg.scale || 1), copyright: `Created By Yunzai-Bot${yunzaiVersion} & xiaoyao-cvs-Plugin${currentVersion}` } - }); + },"png"); if (base64) { e.reply(segment.image(`base64://${base64}`)); diff --git a/index.js b/index.js index 84076fc..922e9b4 100644 --- a/index.js +++ b/index.js @@ -13,14 +13,18 @@ import { } from "./apps/Note.js" import { rule as adminRule, - updateRes,sysCfg, + updateRes, + sysCfg, updateMiaoPlugin } from "./apps/admin.js"; -import { currentVersion } from "./components/Changelog.js"; +import { + currentVersion +} from "./components/Changelog.js"; export { updateRes, updateMiaoPlugin, - versionInfo,sysCfg, + versionInfo, + sysCfg, help, AtlasAlias, Note @@ -29,15 +33,15 @@ export { let rule = { versionInfo: { reg: "^#图鉴版本$", - describe: "【#帮助】 喵喵版本介绍", + describe: "【#帮助】 图鉴版本介绍", }, help: { - reg: "^#图鉴(列表|帮助|help)$", + reg: "^#?(图鉴)?(命令|帮助|菜单|help|说明|功能|指令|使用说明)$", describe: "查看插件的功能", }, AtlasAlias: { reg: "#*(.*)(信息|图鉴|命座|天赋|突破|材料|特色料理|特殊料理)$", - describe: "【刻晴信息、刻晴图鉴、刻晴突破、刻晴命座】角色信息图鉴", + describe: "角色、食物、怪物、武器信息图鉴", }, Note: { reg: "^#*(体力|树脂|查询体力|便笺|便签)$", @@ -57,13 +61,13 @@ export { }; console.log(`图鉴插件${currentVersion}初始化~`); -setTimeout(async function () { - let msgStr = await redis.get("xiaoyao:restart-msg"); - if (msgStr) { - let msg = JSON.parse(msgStr); - await common.relpyPrivate(msg.qq, msg.msg); - await redis.del("xiaoyao:restart-msg"); - let msgs = [`当前版本: ${currentVersion}`, `您可使用 #图鉴版本 命令查看更新信息`]; - await common.relpyPrivate(msg.qq, msgs.join("\n")); - } +setTimeout(async function() { + let msgStr = await redis.get("xiaoyao:restart-msg"); + if (msgStr) { + let msg = JSON.parse(msgStr); + await common.relpyPrivate(msg.qq, msg.msg); + await redis.del("xiaoyao:restart-msg"); + let msgs = [`当前版本: ${currentVersion}`, `您可使用 #图鉴版本 命令查看更新信息`]; + await common.relpyPrivate(msg.qq, msgs.join("\n")); + } }, 1000); diff --git a/resources/dailyNote/dailyNote.css b/resources/dailyNote/dailyNote.css index 4678639..30ff30c 100644 --- a/resources/dailyNote/dailyNote.css +++ b/resources/dailyNote/dailyNote.css @@ -8,84 +8,87 @@ html { height: 100%; font-family: HYWenHei-55W, monospace; } + #container { - min-height: 900px; - height: auto; - width: 100%; - } + min-height: 900px; + height: auto; + width: 100%; + /* background-color: rgba(0,0,0,0.5); */ +} - .title { - position: absolute; - top: 64px; - left: 225px; - font-weight: bold; - font-size: 22px; - text-align: left; - } +.title { + position: absolute; + top: 75px; + left: 225px; + font-weight: bold; + font-size: 22px; + text-align: left; +} - .item { - width: 228px; - left: 200px; - top: 350px; - color: #7b8386; - font-weight: bold; - font-size: 22px; - margin-left: 205px; - margin-bottom: 25px; - } +.item { + width: 228px; + left: 200px; + top: 350px; + color: #7b8386; + font-weight: bold; + font-size: 22px; + margin-left: 205px; + margin-bottom: 25px; +} - .paiqian { - position: absolute; - width: 400px; - height: 26px; - left: 520px; - top: 80px; - text-align: center; - color: #7b8386; - font-weight: bold; - font-size: 20px; - } +.paiqian { + position: absolute; + width: 400px; + height: 26px; + left: 520px; + top: 80px; + text-align: center; + color: #7b8386; + font-weight: bold; + font-size: 20px; +} - .icon { - width: 65px; - margin: 5px 0 4px 13px; - display: inline-block; - vertical-align: bottom; - } +.icon { + width: 65px; + margin: 3px 0 4px 13px; + display: inline-block; + vertical-align: bottom; +} - .icon_div { - display: inline-block; - vertical-align: super; - margin-top: -10px; - margin-left: 15px; - } +.icon_div { + display: inline-block; + vertical-align: super; + margin-top: -10px; + margin-left: 15px; +} - .all_icon { - text-align: left; - position: relative; - top: -25px; - } +.all_icon { + text-align: left; + position: relative; + top: -25px; +} - .time { - position: relative; - top: -20px; - } +.time { + position: relative; + top: -20px; +} - .item .main .time { - font-size: 12px; - display: block; - position: initial; - } +.item .main .time { + font-size: 12px; + display: block; + position: initial; +} - .item .main { - display: block; - } +.item .main { + display: block; +} - .item .top { - font-weight: bold; - font-size: 30px; - display: block; - } - .item:nth-last-child(2){ - margin-top: 35px; - } \ No newline at end of file +.item .top { + font-weight: bold; + font-size: 30px; + display: block; +} + +.item:nth-last-child(2) { + /* margin-top: 35px; */ +} diff --git a/resources/dailyNote/dailyNote.html b/resources/dailyNote/dailyNote.html index eb564a3..e4af6cc 100644 --- a/resources/dailyNote/dailyNote.html +++ b/resources/dailyNote/dailyNote.html @@ -5,6 +5,7 @@ +