From 1607968d3f8171c6bbc103fb4692160d414fb5f9 Mon Sep 17 00:00:00 2001 From: ctrlcvs <1509167646@qq.com> Date: Fri, 9 Sep 2022 10:03:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E9=89=B4=E7=9B=AE=E5=BD=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=90=88=E5=B9=B6=E8=BD=AC=E5=8F=91=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/Note.js | 49 ++++++++++++++----------------------------- apps/xiaoyao_image.js | 5 +++-- model/mys/utils.js | 7 ++++++- 3 files changed, 25 insertions(+), 36 deletions(-) diff --git a/apps/Note.js b/apps/Note.js index 861c3be..bb6f94a 100644 --- a/apps/Note.js +++ b/apps/Note.js @@ -7,9 +7,6 @@ import fs from "fs"; import { isV3 } from '../components/Changelog.js' -// import MysInfo from '../model/mys/mysInfo.js' -// import { MysUser } from "../../../lib/components/Models.js"; -// import common from "../../../lib/common.js"; import lodash from "lodash"; import gsCfg from '../model/gsCfg.js' import { @@ -18,6 +15,7 @@ import { } from "../components/index.js"; import moment from 'moment'; import MysApi from "../model/mys/mysApi.js"; +import utils from "../model/mys/utils.js"; const _path = process.cwd(); let role_user = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/dailyNote/json/`, "dispatch_time"); @@ -287,7 +285,7 @@ export async function Note(e, { async function dateTime_(time) { return moment(time).format("HH") < 6 ? "凌晨" : moment(time).format("HH") < 12 ? "上午" : moment(time).format( - "HH") < 17.5 ? "下午" : moment(time).format("HH") < 19.5 ? "傍晚" : moment(time).format("HH") < 22 ? "晚上" : + "HH") < 17.5 ? "下午" : moment(time).format("HH") < 19.5 ? "傍晚" : moment(time).format("HH") < 22 ? "晚上" : "深夜"; } async function getDailyNote(uid, cookie) { @@ -381,49 +379,38 @@ export async function Note_appoint(e) { msg = urlType[msg - 1]; } let type = 0; - let nickname = Bot.nickname; - if (e.isGroup) { - let info = await Bot.getGroupMemberInfo(e.group_id, Bot.uin) - nickname = info.card || info.nickname - } if (msg.includes("列表")) { let xlmsg=msg.replace("列表","")*1 || 1 let mstList = []; let sumCount=(urlType.length/80+0.4).toFixed(0); xlmsg=sumCount-xlmsg>-1?xlmsg:sumCount==0?1:sumCount; - urlType.unshift(`模板列表共,第${xlmsg}页,共${urlType.length}张,\n您可通过【#体力模板设置1】来绑定你需要的体力模板~\n请选择序号~~\n当前支持选择的模板有:`) let xxmsg=(xlmsg-1)<=0?0:80*(xlmsg-1) let count=0; + let msgData=[`模板列表共,第${xlmsg}页,共${urlType.length}张,\n您可通过【#体力模板设置1】来绑定你需要的体力模板~\n请选择序号~~\n当前支持选择的模板有:`]; for (let [index, item] of urlType.entries()) { let msg_pass = []; let imgurl; - if (index != 0) { - if (item.includes(".")) { - imgurl = await segment.image(`file:///${mbPath}background_image/${item}`); - item = item.split(".")[0]; - } else { - imgurl = await segment.image( - `file:///${mbPath}Template/${item}/icon/bg/${fs.readdirSync(`${mbPath}/Template/${item}/icon/bg/`)[0]}` - ) - } - item = index + "." + item + if (item.includes(".")) { + imgurl = await segment.image(`file:///${mbPath}background_image/${item}`); + item = item.split(".")[0]; + } else { + imgurl = await segment.image( + `file:///${mbPath}Template/${item}/icon/bg/${fs.readdirSync(`${mbPath}/Template/${item}/icon/bg/`)[0]}` + ) } + item = index+1 + "." + item count++; if(Object.keys(mstList).length==80){ break; } - if(index