2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2025-01-05 15:11:08 +08:00

图鉴目录修改为合并转发格式

This commit is contained in:
ctrlcvs 2022-09-09 10:03:17 +08:00
parent c81e0518fb
commit 1607968d3f
3 changed files with 25 additions and 36 deletions

View File

@ -7,9 +7,6 @@ import fs from "fs";
import { import {
isV3 isV3
} from '../components/Changelog.js' } 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 lodash from "lodash";
import gsCfg from '../model/gsCfg.js' import gsCfg from '../model/gsCfg.js'
import { import {
@ -18,6 +15,7 @@ import {
} from "../components/index.js"; } from "../components/index.js";
import moment from 'moment'; import moment from 'moment';
import MysApi from "../model/mys/mysApi.js"; import MysApi from "../model/mys/mysApi.js";
import utils from "../model/mys/utils.js";
const _path = process.cwd(); const _path = process.cwd();
let role_user = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/dailyNote/json/`, "dispatch_time"); let role_user = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/dailyNote/json/`, "dispatch_time");
@ -381,23 +379,17 @@ export async function Note_appoint(e) {
msg = urlType[msg - 1]; msg = urlType[msg - 1];
} }
let type = 0; 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("列表")) { if (msg.includes("列表")) {
let xlmsg=msg.replace("列表","")*1 || 1 let xlmsg=msg.replace("列表","")*1 || 1
let mstList = []; let mstList = [];
let sumCount=(urlType.length/80+0.4).toFixed(0); let sumCount=(urlType.length/80+0.4).toFixed(0);
xlmsg=sumCount-xlmsg>-1?xlmsg:sumCount==0?1:sumCount; 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 xxmsg=(xlmsg-1)<=0?0:80*(xlmsg-1)
let count=0; let count=0;
let msgData=[`模板列表共,第${xlmsg}页,共${urlType.length}张,\n您可通过【#体力模板设置1】来绑定你需要的体力模板~\n请选择序号~~\n当前支持选择的模板有:`];
for (let [index, item] of urlType.entries()) { for (let [index, item] of urlType.entries()) {
let msg_pass = []; let msg_pass = [];
let imgurl; let imgurl;
if (index != 0) {
if (item.includes(".")) { if (item.includes(".")) {
imgurl = await segment.image(`file:///${mbPath}background_image/${item}`); imgurl = await segment.image(`file:///${mbPath}background_image/${item}`);
item = item.split(".")[0]; item = item.split(".")[0];
@ -406,24 +398,19 @@ export async function Note_appoint(e) {
`file:///${mbPath}Template/${item}/icon/bg/${fs.readdirSync(`${mbPath}/Template/${item}/icon/bg/`)[0]}` `file:///${mbPath}Template/${item}/icon/bg/${fs.readdirSync(`${mbPath}/Template/${item}/icon/bg/`)[0]}`
) )
} }
item = index + "." + item item = index+1 + "." + item
}
count++; count++;
if(Object.keys(mstList).length==80){ if(Object.keys(mstList).length==80){
break; break;
} }
if(index<xxmsg&&index!=0){ if(index<xxmsg){
continue; continue;
} }
msg_pass.push(item) msg_pass.push(item)
if (imgurl) { if (imgurl) {
msg_pass.push(imgurl) msg_pass.push(imgurl)
} }
mstList.push({ msgData.push(msg_pass)
message: msg_pass,
nickname: nickname,
user_id: Bot.uin
})
} }
let endMsg=""; let endMsg="";
if(count<urlType.length-1){ if(count<urlType.length-1){
@ -431,12 +418,8 @@ export async function Note_appoint(e) {
}else{ }else{
endMsg= `已经到底了~~` endMsg= `已经到底了~~`
} }
mstList.push({ msgData.push(endMsg)
message: endMsg, await utils.replyMake(e, msgData, 0)
nickname: nickname,
user_id: Bot.uin
})
e.reply(await Bot.makeForwardMsg(mstList));
return true; return true;
} }
if(urlType.includes(msg+".png")){ if(urlType.includes(msg+".png")){

View File

@ -12,6 +12,7 @@ import gsCfg from '../model/gsCfg.js'
import { import {
isV3 isV3
} from '../components/Changelog.js' } from '../components/Changelog.js'
import utils from "../model/mys/utils.js";
const _path = process.cwd(); const _path = process.cwd();
const __dirname = path.resolve(); const __dirname = path.resolve();
@ -106,10 +107,10 @@ export async function Atlas_list(e) {
let list = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/Atlas_alias/`, "Atlas_list"); let list = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/Atlas_alias/`, "Atlas_list");
let name = e.msg.replace(/#|井/g, "") let name = e.msg.replace(/#|井/g, "")
for (let i in list) { for (let i in list) {
var title = i.split("|"); let title = i.split("|");
for (let j = 0; j < title.length; j++) { for (let j = 0; j < title.length; j++) {
if (title[j] == name) { if (title[j] == name) {
await e.reply("请选择:\n" + list[i].join("\n")) await utils.replyMake(e, [`当前选择【${name}`,"请选择:\n" + list[i].join("\n")], 0)
return true; return true;
} }
} }

View File

@ -53,7 +53,12 @@ export async function replyMake(e, _msg, lenght) {
user_id: Bot.uin user_id: Bot.uin
}) })
} }
if(e._reply){
e._reply(await Bot.makeForwardMsg(msgList)); e._reply(await Bot.makeForwardMsg(msgList));
}else {
e.reply(await Bot.makeForwardMsg(msgList));
}
} }
export async function getCookieMap(cookie) { export async function getCookieMap(cookie) {
let cookiePattern = /^(\S+)=(\S+)$/; let cookiePattern = /^(\S+)=(\S+)$/;