forked from xrenata/discord-handler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (25 loc) · 924 Bytes
/
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
const { Client, Collection, MessageEmbed } = require("discord.js");
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const fs = require("node:fs");
const config = require("./config.json");
const client = new Client({
intents: 32767
});
client.config = require("./config")
client.slash_commands = new Collection();
client.events = new Collection();
module.exports = client;
["slash", "event" , "function"].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
process.on('unhandledRejection', err => {
console.log(`[HATA] Unhandled promise rejection: ${err.message}.`);
console.log(err);
});
const start = process.env.TOKEN || config.client.TOKEN;
if (!start) {
console.warn("[Warn] Token!").then(async () => process.exit(1));
} else {
client.login(start).catch(() => console.log("[Warn] Token error."));
}