-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
41 lines (38 loc) · 1.66 KB
/
main.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
const { Client, Collection,WebhookClient } = require('discord.js');
const { loadCommands, loadEvents } = require("./util/loader");
const client = new Client({ intents: ['GUILDS','GUILD_MESSAGES','GUILD_MEMBERS','GUILD_EMOJIS','GUILD_WEBHOOKS','GUILD_PRESENCES','GUILD_MESSAGE_REACTIONS'] },{ partials: ['MESSAGE', 'CHANNEL', 'REACTION'] });;
require('./util/functions')(client);
client.mongoose = require("./util/mongoose");
["commands", "cooldowns"].forEach(x => client[x] = new Collection());
loadCommands(client);
loadEvents(client);
client.mongoose.init();
client.config = require("./config")
client.login(client.config.TOKEN);
//client.on('ready',()=> require('./test.js')(client));
process.on('uncaughtException', (error) => {
console.warn(error);
if (!client) return;
client.errorHook.send(error, {code: 'js'});
});
process.on('unhandledRejection', (listener) => {
console.warn(listener);
if (!client) return;
client.errorHook.send(listener, {code: 'js'});
});
process.on('rejectionHandled', (listener) => {
console.warn(listener);
if (!client) return;
client.errorHook.send(listener, {code: 'js'});
});
process.on('warning', (warning) => {
console.warn(warning);
if (!client) return;
client.errorHook.send(warning, {code: 'js'});
});
client.errorHook = new WebhookClient(
`${client.config.ERREURS.WEBHOOKID}`, `${client.config.ERREURS.WEBHOOKTOKEN}`);
/*client.on("disconnect", () => console.log("Bot is disconnecting...", "warn"))
.on("reconnecting", () => console.log("Bot reconnecting...", "log"))
.on("error", (e) => console.log(e, "error"))
.on("warn", (info) => console.log(info, "warn"));*/