forked from NotJust9999/Automatic-Role-Adder
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
48 lines (44 loc) · 1.96 KB
/
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
39
40
41
42
43
44
45
46
47
48
const { Client, Collection } = require("discord.js");
const colors = require("colors")
const config = require(`${process.cwd()}/config.json`);
const client = new Client({
intents: 32767,
});
module.exports = client;
// Global Variables
client.commands = new Collection();
client.slashCommands = new Collection();
const fs = require(`fs`);
client.config = require("./config.json");
// Initializing the project
require("./handler")(client);
client.login(config.token)
/* ANTI CRASHING ¦¦ ANTI CRASHING */
process.on('unhandledRejection', (reason, p) => {
console.log('\n\n\n\n\n=== unhandled Rejection ==='.toUpperCase().yellow.dim);
console.log('Reason: ', reason.stack ? String(reason.stack).gray : String(reason).gray);
console.log('=== unhandled Rejection ===\n\n\n\n\n'.toUpperCase().yellow.dim);
});
process.on("uncaughtException", (err, origin) => {
console.log('\n\n\n\n\n\n=== uncaught Exception ==='.toUpperCase().yellow.dim);
console.log('Exception: ', err.stack ? err.stack : err)
console.log('=== uncaught Exception ===\n\n\n\n\n'.toUpperCase().yellow.dim);
})
process.on('uncaughtExceptionMonitor', (err, origin) => {
console.log('=== uncaught Exception Monitor ==='.toUpperCase().yellow.dim);
});
process.on('beforeExit', (code) => {
console.log('\n\n\n\n\n=== before Exit ==='.toUpperCase().yellow.dim);
console.log('Code: ', code);
console.log('=== before Exit ===\n\n\n\n\n'.toUpperCase().yellow.dim);
});
process.on('exit', (code) => {
console.log('\n\n\n\n\n=== exit ==='.toUpperCase().yellow.dim);
console.log('Code: ', code);
console.log('=== exit ===\n\n\n\n\n'.toUpperCase().yellow.dim);
});
process.on('multipleResolves', (type, promise, reason) => {
console.log('\n\n\n\n\n=== multiple Resolves ==='.toUpperCase().yellow.dim);
console.log(type, promise, reason);
console.log('=== multiple Resolves ===\n\n\n\n\n'.toUpperCase().yellow.dim);
});