mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-22 19:10:53 +08:00
fix:修正多模板报错问题
This commit is contained in:
parent
ffd380ec52
commit
46a0f290e7
23
apps/Note.js
23
apps/Note.js
@ -233,8 +233,13 @@ export async function Note(e, {
|
||||
}
|
||||
let img_path = `./plugins/xiaoyao-cvs-plugin/resources/dailyNote/${path_img[mb]}`;
|
||||
if (tempData[e.user_id] && tempData[e.user_id].type > -1) {
|
||||
mb = tempData[e.user_id].type;
|
||||
objFile = tempData[e.user_id].temp;
|
||||
// mb = tempData[e.user_id].type;
|
||||
objFile = tempData[e.user_id].temp[lodash.random(0, tempData[e.user_id].temp.length - 1)];
|
||||
if (objFile.includes(".")) { //对于模板类型处理
|
||||
mb = 0;
|
||||
} else {
|
||||
mb = 1
|
||||
}
|
||||
}
|
||||
if (mb == 1) {
|
||||
for (var i = 0; i < 5 - data.expeditions.length; i++) {
|
||||
@ -409,14 +414,14 @@ export async function Note_appoint(e) {
|
||||
}
|
||||
let type = 0;
|
||||
if (msg.includes("列表")) {
|
||||
let isUser= msg.includes('我的')
|
||||
let temp =tempData[e.user_id]?.temp;
|
||||
if(!temp&&isUser){
|
||||
let isUser = msg.includes('我的')
|
||||
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 listLength = isUser ? temp.length : keyType.length
|
||||
let sumCount = (listLength / 80 + 0.49).toFixed(0);
|
||||
xlmsg = sumCount - xlmsg > -1 ? xlmsg : sumCount == 0 ? 1 : sumCount;
|
||||
let xxmsg = (xlmsg - 1) <= 0 ? 0 : 80 * (xlmsg - 1)
|
||||
@ -433,7 +438,7 @@ export async function Note_appoint(e) {
|
||||
`file:///${urlType[item]}/icon/bg/${fs.readdirSync(`${urlType[item]}/icon/bg/`)[0]}`
|
||||
)
|
||||
}
|
||||
if(isUser&&!temp.includes(item)){
|
||||
if (isUser && !temp.includes(item)) {
|
||||
continue;
|
||||
}
|
||||
item = index + 1 + "." + item
|
||||
@ -475,7 +480,7 @@ export async function Note_appoint(e) {
|
||||
}
|
||||
}
|
||||
let temp = [];
|
||||
if(!tempData[e.user_id]){
|
||||
if (!tempData[e.user_id]) {
|
||||
tempData[e.user_id] = {
|
||||
temp: [],
|
||||
type: type,
|
||||
@ -484,7 +489,7 @@ export async function Note_appoint(e) {
|
||||
if (typeof tempData[e.user_id]["temp"] === "string") {
|
||||
temp = [tempData[e.user_id]["temp"], msg]
|
||||
} else {
|
||||
if(!tempData[e.user_id]["temp"].includes(msg)){
|
||||
if (!tempData[e.user_id]["temp"].includes(msg)) {
|
||||
temp = [...tempData[e.user_id]["temp"], msg]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user