-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (23 loc) · 832 Bytes
/
index.js
File metadata and controls
28 lines (23 loc) · 832 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
"use strict";
require("dotenv").config();
const logger = require("./lib/log.js");
const Client = require("./structures/Client");
const client = new Client();
// Logging in the bot
if (process.env.PRODUCTION) {
client.login(process.env.BOT_TOKEN_PROD).then().catch(err => logger.error(err));
} else {
client.login(process.env.BOT_TOKEN_DEV).then().catch(err => logger.error(err));
}
process.on("unhandledRejection", err => {
logger.error(`[Node Error] Unhandled Promise Rejection:'${err.stack}`);
});
process.on("unhandledException", err => {
logger.error(`[Node Error] Unhandled Exception:'${err.stack}`);
});
process.on("SIGINT", () => { // CTRL+C / Kill process event
logger.info("[Client] Shutting down...");
client.destroy();
logger.info("[Client] Shut down. Goodbye!");
process.exit();
});