1 Star 0 Fork 1

小谢/biscuit-plugin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.js 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
饼干 提交于 2023-09-23 14:05 . bug
import fs from "node:fs";
import chalk from 'chalk'
import path from 'path'
try {
await import('axios')
} catch (error) {
if (error.stack?.includes('Cannot find package')) {
logger.warn('--------biscuit依赖缺失--------')
logger.warn(`biscuit-plugin 缺少依赖将无法使用 ${logger.yellow('部分用不了')}`)
logger.warn(`如需使用请运行:${logger.red('pnpm add axios -w')}`)
logger.warn('---------------------------')
logger.debug(decodeURI(error.stack))
} else {
logger.error(`biscuit载入依赖错误:${logger.red('axios')}`)
logger.error(decodeURI(error.stack))
}
}
logger.info(chalk.cyan('----------\(≧▽≦)/---------'))
logger.info(chalk.yellow(`biscuit-plugin初始化~`))
logger.info(chalk.yellow(`发送饼干帮助解锁功能哦~`))
logger.info(chalk.magenta('-------------------------'))
const files = fs
.readdirSync("./plugins/biscuit-plugin/apps")
.filter((file) => file.endsWith(".js"));
let ret = [];
files.forEach((file) => {
ret.push(import(`./apps/${file}`));
});
ret = await Promise.allSettled(ret);
let apps = {};
for (let i in files) {
let name = files[i].replace(".js", "");
if (ret[i].status != "fulfilled") {
logger.error(`载入插件错误:${logger.red(name)}`);
logger.error(ret[i].reason);
continue;
}
apps[name] = ret[i].value[Object.keys(ret[i].value)[0]];
}
export { apps };
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/angelina_xiaoxie/biscuit-plugin.git
git@gitee.com:angelina_xiaoxie/biscuit-plugin.git
angelina_xiaoxie
biscuit-plugin
biscuit-plugin
master

搜索帮助