1 Star 13 Fork 1

misaki-me/沙雕插件

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.js 695 Bytes
一键复制 编辑 原始数据 按行查看 历史
misaki-me 提交于 2023-11-25 21:15 +08:00 . update
import fs from 'node:fs'
import { initWebSocket } from './components/index.js'
const files = fs.readdirSync('./plugins/tg-plugin/apps').filter(file => file.endsWith('.js'))
let ret = []
logger.info(`--------tg-plugin插件初始化~--------`)
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]]
}
initWebSocket()
export { apps }
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/misakime/tg-plugin.git
git@gitee.com:misakime/tg-plugin.git
misakime
tg-plugin
沙雕插件
master

搜索帮助