-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (27 loc) · 795 Bytes
/
Copy pathindex.js
File metadata and controls
32 lines (27 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
import fs from 'fs'
import './lib/init.js'
import './lib/bot.js'
import './model/config.js'
import './adapter/adapter.js'
import './adapter/Bot/bot.js'
import './adapter/Bot/icqq.js'
let ret = []
let apps = {}
const files = fs.readdirSync('./plugins/Lain-plugin/apps').filter(file => file.endsWith('.js'))
files.forEach((file) => {
ret.push(import(`./apps/${file}`))
})
ret = await Promise.allSettled(ret)
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]]
for (let clazz of Object.keys(ret[i].value)) {
apps[clazz] = ret[i].value[clazz]
}
}
export { apps }