1 Star 22 Fork 1

憨憨/hanhan-plugin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
index.js 2.08 KB
一键复制 编辑 原始数据 按行查看 历史
憨憨 提交于 2024-08-20 20:32 . fix: 修复一些小问题
import fs from 'node:fs'
import chalk from 'chalk'
import { Config } from './utils/config.js'
if (!global.segment) {
global.segment = (await import('oicq')).segment
}
const files = fs.readdirSync('./plugins/hanhan-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]]
}
logger.info(`${chalk.redBright.bold('********************[')}${chalk.cyan.bold('hanhan')}${chalk.redBright.bold(']********************')}`)
logger.info(`${chalk.blue.bold('han')}${chalk.redBright.bold('han')}${chalk.gray.bold('-')}${chalk.cyan.bold('plugin')}${chalk.whiteBright.bold('加载')}${chalk.greenBright.bold('成功')}`)
logger.info(chalk.green.bold(' ▃▆█▇▄▖'))
logger.info(chalk.green.bold('      ▟◤▖ ◥█▎'))
logger.info(chalk.green.bold('   ◢◤  ▐    ▐▉'))
logger.info(chalk.green.bold('  ▗◤   ▂ ▗▖  ▕█▎'))
logger.info(chalk.green.bold(' ◤ ▗▅▖◥▄ ▀◣  █▊'))
logger.info(chalk.green.bold('▐ ▕▎◥▖◣◤    ◢██'))
logger.info(chalk.green.bold('█◣ ◥▅█▀    ▐██◤'))
logger.info(chalk.green.bold('▐█▙▂    ◢██◤'))
logger.info(chalk.green.bold('◥██◣    ◢▄◤'))
logger.info(chalk.green.bold('   ▀██▅▇▀'))
logger.info(chalk.green.bold(`当前版本 v${Config.version}`))
logger.info(`${chalk.cyan.italic('仓库地址')} ${chalk.yellowBright.underline('https://github.com/hanhan258/hanhan-plugin')}`)
logger.info(`${chalk.redBright.bold('********************[')}${chalk.cyan.bold('///^///')}${chalk.redBright.bold(']********************')}`)
export { apps }
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
NodeJS
1
https://gitee.com/han-hanz/hanhan-plugin.git
[email protected]:han-hanz/hanhan-plugin.git
han-hanz
hanhan-plugin
hanhan-plugin
v1

搜索帮助