-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·34 lines (28 loc) · 795 Bytes
/
index.js
File metadata and controls
executable file
·34 lines (28 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import fs from 'node:fs'
import {
pluginName,
pluginApplications
} from "./config/constant.js"
const files = fs.readdirSync(pluginApplications).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.mark(`${pluginName}插件载入完毕`)
logger.mark("交流群 893157055")
logger.info(" ╱|、")
logger.info("(˚ˎ 。7")
logger.info(" |、˜〵")
logger.info("じしˍ,)ノ")
export { apps }