-
Notifications
You must be signed in to change notification settings - Fork 21
/
index.js
48 lines (41 loc) · 1.25 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,
GatewayIntentBits,
Partials,
Collection,
} = require("discord.js");
const { loadEvents } = require("./Handlers/eventHandler");
const { loadCommands } = require("./Handlers/commandHandler");
const client = new Client({
intents: [Object.keys(GatewayIntentBits)],
partials: [Object.keys(Partials)],
});
client.on("unhandledRejection", (reason, p) => {
const ChannelID = "1061924092346904657";
console.error("Unhandled promise rejection:", reason, p);
const Embed = new EmbedBuilder()
.setColor("#235ee7")
.setTimestamp()
.setFooter({ text: "Crash Prevention" })
.setTitle("Error Encountered");
const Channel = client.channels.cache.get(ChannelID);
if (!Channel) return;
Channel.send({
embeds: [
Embed.setDescription(
"**Unhandled Rejection/Catch:\n\n** ```" + reason + "```"
),
],
});
});
client.config = require("./config.json");
client.giveawayConfig = require("./config.js");
client.commands = new Collection();
['giveawaysEventsHandler', 'giveawaysManager'].forEach((x) => {
require(`./Utils/${x}`)(client);
})
module.exports = client;
client.login(client.config.token).then(() => {
loadEvents(client);
loadCommands(client);
});