删除一些不必要的文件

This commit is contained in:
yeyang
2022-11-02 23:26:43 +08:00
parent 2d540762e9
commit 1526f4fd94
9 changed files with 13 additions and 91 deletions

View File

@@ -1,6 +1,6 @@
import plugin from '../../../lib/plugins/plugin.js'
import { update } from '../../other/update.js'
import { Version, Common, Plugin_Name } from '../components/index.js'
import { Version, render, Plugin_Name } from '../components/index.js'
export class admin extends plugin {
constructor() {
@@ -40,7 +40,7 @@ export class admin extends plugin {
async function versionInfo(e) {
return await Common.render('help/version-info', {
return await render('help/version-info', {
currentVersion: Version.ver,
changelogs: Version.logs,
elem: 'cryo'

View File

@@ -1,7 +1,7 @@
import plugin from '../../../lib/plugins/plugin.js'
import fs from 'fs'
import lodash from 'lodash'
import { Common, Data } from '../components/index.js'
import { render, Data } from '../components/index.js'
export class yenai_help extends plugin {
constructor() {
@@ -60,7 +60,7 @@ async function help(e) {
})
let bg = await rodom()
let colCount = 3;
return await Common.render('help/index', {
return await render('help/index', {
helpCfg: helpConfig,
helpGroup,
bg,

View File

@@ -1,8 +1,7 @@
import plugin from '../../../lib/plugins/plugin.js'
import fs from "fs";
import lodash from "lodash";
import Common from "../components/Common.js";
import { Config } from '../components/index.js'
import { Config, render } from '../components/index.js'
let rediskey = `yenai:proxy`
export class NewConfig extends plugin {
@@ -145,7 +144,7 @@ export class NewConfig extends plugin {
bg: await rodom(), //获取底图
}
//渲染图像
return await Common.render("admin/index", {
return await render("admin/index", {
...cfg,
}, {
e,

View File

@@ -1,10 +1,9 @@
import plugin from '../../../lib/plugins/plugin.js'
import os from 'os';
import { Version, Common, Config } from '../components/index.js'
import { Version, render, Config } from '../components/index.js'
import CPU from '../model/CPU.js';
import Cfg from '../model/Config.js';
import fs from 'fs'
import fetch from 'node-fetch';
import moment from 'moment';
export class example extends plugin {
constructor() {
@@ -136,7 +135,7 @@ export class example extends plugin {
takejs: fs.readdirSync("./plugins/example")?.length || 0
}
//渲染图片
await Common.render('state/state', {
await render('state/state', {
...data,
}, {
e,

View File

@@ -1,45 +0,0 @@
import fs from 'fs'
import lodash from 'lodash'
const _path = process.cwd()
const _cfgPath = `${_path}/plugins/yenai-plugin/components/`
let cfg = {}
try {
if (fs.existsSync(_cfgPath + 'cfg.json')) {
cfg = JSON.parse(fs.readFileSync(_cfgPath + 'cfg.json', 'utf8')) || {}
}
} catch (e) {
// do nth
}
let Cfg = {
get(rote, def = '') {
return lodash.get(cfg, rote, def)
},
set(rote, val) {
lodash.set(cfg, rote, val)
fs.writeFileSync(_cfgPath + 'cfg.json', JSON.stringify(cfg, null, '\t'))
},
del(rote) {
lodash.set(cfg, rote, undefined)
fs.writeFileSync(_cfgPath + 'cfg.json', JSON.stringify(cfg, null, '\t'))
},
scale(pct = 1) {
let scale = Cfg.get('sys.scale', 100)
scale = Math.min(2, Math.max(0.5, scale / 100))
pct = pct * scale
return `style=transform:scale(${pct})`
},
isDisable(e, rote) {
if (Cfg.get(rote, true)) {
return false
}
if (/^#*小飞/.test(e.msg || '')) {
return false
}
return true
}
}
export default Cfg

View File

@@ -1,13 +0,0 @@
import Cfg from './Cfg.js'
import render from './common-lib/render.js'
function sleep (ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
export default {
render,
cfg: Cfg.get,
isDisable: Cfg.isDisable,
sleep
}

View File

@@ -1,15 +0,0 @@
{
"sys": {
"help": true,
"scale": 100
},
"char": {
"wife": false,
"char": true
},
"wiki": {
"abyss": true,
"wiki": false,
"stat": true
}
}

View File

@@ -3,8 +3,6 @@ const Plugin_Name = 'yenai-plugin'
const Plugin_Path = `${Path}/plugins/${Plugin_Name}`;
import Version from './Version.js'
import Data from './Data.js'
import Cfg from './Cfg.js'
import Common from './Common.js'
import Config from './Config.js'
export { Cfg, Common, Config, Data, Version, Path, Plugin_Name, Plugin_Path }
import render from './render.js';
export { render, Config, Data, Version, Path, Plugin_Name, Plugin_Path }

View File

@@ -1,7 +1,6 @@
import { Data, Version, Plugin_Name } from '../index.js'
import Cfg from '../Cfg.js'
import { Data, Version, Plugin_Name } from './index.js'
import fs from 'fs'
import puppeteer from '../../../../lib/puppeteer/puppeteer.js'
import puppeteer from '../../../lib/puppeteer/puppeteer.js'
const _path = process.cwd()
@@ -26,7 +25,7 @@ export default async function (path, params, cfg) {
waitUntil: 'networkidle0'
},
sys: {
scale: Cfg.scale(cfg.scale || 1),
scale: `style=transform:scale(${cfg.scale || 1})`,
copyright: `Created By Yunzai-Bot<span class="version">${Version.yunzai}</span> & yenai-Plugin<span class="version">${Version.ver}</span>`
},
quality: 100