🪛 chore: 轻度修改插件架构

This commit is contained in:
zhiyu1998 2024-08-11 14:57:20 +08:00
parent 505d5a18c8
commit b4ce6c95e0
3 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import puppeteer from "../../../lib/puppeteer/puppeteer.js";
import lodash from "lodash"; import lodash from "lodash";
import YAML from "yaml"; import YAML from "yaml";
import fs from "node:fs"; import fs from "node:fs";
import path from "path";
import { exec, execSync } from "node:child_process"; import { exec, execSync } from "node:child_process";
import { copyFiles, deleteFolderRecursive, readCurrentDir } from "../utils/file.js"; import { copyFiles, deleteFolderRecursive, readCurrentDir } from "../utils/file.js";

View File

@ -5,11 +5,13 @@ if (!global.segment) {
global.segment = (await import("oicq")).segment global.segment = (await import("oicq")).segment
} }
// 加载版本号
const versionData = config.getConfig("version"); const versionData = config.getConfig("version");
// 加载名称
const packageJsonPath = path.join('./plugins', 'rconsole-plugin', 'package.json'); const packageJsonPath = path.join('./plugins', 'rconsole-plugin', 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const pluginName = packageJson.name; const pluginName = packageJson.name;
// 初始化输出
logger.info(logger.yellow(`R插件${versionData[0].version}初始化欢迎加入【R插件和它的朋友们】秋秋群575663150`)); logger.info(logger.yellow(`R插件${versionData[0].version}初始化欢迎加入【R插件和它的朋友们】秋秋群575663150`));
const files = fs.readdirSync(`./plugins/${pluginName}/apps`).filter(file => file.endsWith(".js")); const files = fs.readdirSync(`./plugins/${pluginName}/apps`).filter(file => file.endsWith(".js"));

View File

@ -8,7 +8,6 @@ class RConfig extends Base{
constructor(e) { constructor(e) {
super(e); super(e);
this.configPath = `./plugins/${RConfig.pluginName}/config/`; this.configPath = `./plugins/${RConfig.pluginName}/config/`;
this.change = new Map();
this.previousContent = new Map(); // 存储每个文件之前的内容 this.previousContent = new Map(); // 存储每个文件之前的内容
} }
@ -39,7 +38,6 @@ class RConfig extends Base{
const yaml = YAML.parse(fs.readFileSync(file, 'utf8')); const yaml = YAML.parse(fs.readFileSync(file, 'utf8'));
if (isWatch) { if (isWatch) {
this.change.set(name);
this.previousContent.set(name, yaml); // 保存初始内容 this.previousContent.set(name, yaml); // 保存初始内容
this.watch(file, name); this.watch(file, name);
} }