forked from IceDynamix/auctionBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (23 loc) · 742 Bytes
/
index.js
File metadata and controls
27 lines (23 loc) · 742 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
require('./modules/config');
const database = require("./modules/database");
const bot = require("./modules/discord");
let discordClient;
let db;
async function main() {
db = await database.connect();
discordClient = await bot.run(db);
}
main().catch(console.error);
process.on('SIGTERM', () => process.emit('requestShutdown'));
process.on('SIGINT', () => process.emit('requestShutdown'));
process.once('requestShutdown', async () => {
process.on('requestShutdown', () => console.log(`process ${process.pid} already shutting down...`));
console.log('shutting down...');
if (discordClient) {
discordClient.destroy();
}
if (db) {
await db.close();
}
console.log('Shutdown complete');
});