-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
40 lines (32 loc) · 987 Bytes
/
index.js
File metadata and controls
40 lines (32 loc) · 987 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
35
36
37
38
39
40
'use strict';
require('dotenv').config();
const Sdk = require('@botsocket/discord-sdk');
const Path = require('path');
const Fs = require('fs');
const internals = {};
internals.bootstrap = async () => {
const client = Sdk.client({
registry: {
prefix: process.env.PREFIX,
},
});
await client.register({
plugin: require('@botsocket/db-plugin'),
options: {
provider: require('@botsocket/db-plugin/providers/JSONProvider'),
providerOptions: {
dataDir: Path.join(__dirname, '..', 'data'),
},
},
});
for (const plugin of Fs.readdirSync(Path.join(__dirname, 'plugins'))) {
try {
await client.register(require(Path.join(__dirname, 'plugins', plugin)));
}
catch (e) {
client.logger.error(`Error while loading plugin ${plugin}:\n${e?.stack || e}`);
}
}
await client.start();
};
internals.bootstrap();