2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-22 19:10:53 +08:00

恢复V2体力推送方法,V3体力推送方法需要请尝试自定义,这里暂时不做处理

This commit is contained in:
Ctrlcvs 2022-09-13 23:06:47 +08:00
parent 03883430a1
commit e95cecff96
2 changed files with 28 additions and 1 deletions

View File

@ -22,3 +22,22 @@ export async function render (app = '', tpl = '', data = {}, imgType = 'jpeg') {
data.pluResPath = data._res_path
return await puppeteer.screenshot(`${plugin}/${app}/${tpl}`, data)
}
export function getRender () {
return async function render (app = '', tpl = '', data = {}, imgType = 'jpeg') {
// 在data中保存plugin信息
data._plugin = plugin
if (lodash.isUndefined(data._res_path)) {
data._res_path = `../../../../../plugins/${plugin}/resources/`
}
if(imgType == "png"){
data.omitBackground=true;
}
data.imgType=imgType;
Data.createDir(_path + '/data/', `html/${plugin}/${app}/${tpl}`)
data.saveId = data.saveId || data.save_id || tpl
data.tplFile = `./plugins/${plugin}/resources/${app}/${tpl}.html`
data.pluResPath = data._res_path
return await puppeteer.screenshot(`${plugin}/${app}/${tpl}`, data)
}
}

View File

@ -16,6 +16,7 @@ import {
import moment from 'moment';
import MysApi from "../model/mys/mysApi.js";
import utils from "../model/mys/utils.js";
import {getRender} from "../adapter/render.js"
const _path = process.cwd();
let role_user = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/resources/dailyNote/json/`, "dispatch_time");
@ -352,7 +353,13 @@ export async function DailyNoteTask() {
redis.set(sendkey, "1", {
EX: sendCD
});
// await Note(e, getPluginRender("xiaoyao-cvs-plugin"));
if(isV3){
await Note(e, {render:await getRender()});
}else{
let {getPluginRender} = await import(`file://${_path}/lib/render.js`);
await Note(e, {render:await getPluginRender()});
}
}
}
}
@ -361,6 +368,7 @@ export async function pokeNote(e,{render}) {
if (!Cfg.get("note.poke")) {
return false;
}
// return await Note(e,{render:await getRender()}, "poke");
return await Note(e,{render}, "poke");
}