forked from erzaozi/waves-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (27 loc) · 913 Bytes
/
index.js
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
35
36
37
38
import fs from 'node:fs';
import Init from './model/init.js'
if (!global.segment) {
global.segment = (await import("oicq")).segment;
}
let ret = [];
logger.info(logger.yellow("- 正在载入 WAVES-PLUGIN"));
const files = fs
.readdirSync('./plugins/waves-plugin/apps')
.filter((file) => file.endsWith('.js'));
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(logger.green("- WAVES-PLUGIN 载入成功"));
logger.info(logger.magenta(`- 欢迎加入新组织【貓娘樂園🍥🏳️⚧️】(群号 707331865)`));
export { apps };