forked from ShauryaB537/Discord.js-v14-Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
82 lines (75 loc) · 2.44 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const {Client, Collection, GatewayIntentBits, Partials } = require('discord.js');
require('dotenv').config();
const fs = require('fs');
const OS = require('os');
const Events = require('events');
require('colors');
// Initialzing Client
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.DirectMessageReactions,
GatewayIntentBits.DirectMessageTyping,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildBans,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.GuildIntegrations,
GatewayIntentBits.GuildInvites,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildMessageTyping,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildScheduledEvents,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildWebhooks,
GatewayIntentBits.MessageContent
],
partials: [
Partials.Channel,
Partials.Message,
Partials.GuildMember,
Partials.GuildScheduledEvent,
Partials.Reaction,
Partials.ThreadMember,
Partials.User
],
allowedMentions: {
parse: ["everyone", "roles", "users"],
users: [],
roles: [],
repliedUser: true,
},
});
// Increasing Event Listener Size
client.setMaxListeners(0);
Events.defaultMaxListeners = 0;
process.env.UV_THREADPOOL_SIZE = OS.cpus().length;
// Exporting client
module.exports = client;
// Defining useful collection
client.slashCommands = new Collection();
client.legacyCommands = new Collection();
client.aliases = new Collection();
client.categories = fs.readdirSync("./Commands/LegacyCommands");
client.context = new Collection();
client.events = 0;
// Default color for your embed
client.color = 3092790;
// Your Bot's prefix
client.prefix = 't!';
// Default footer for your embed
client.footer = "Keeps it fun!";
// Connecting handlers
["SlashCommands_Handler", "LegacyCommands_Handler", "Event_Handler", "Error_Handler"].forEach(handler => {
require(`./handlers/${handler}`)(client);
});
// Logging in Discord
if (!process.env.TOKEN) {
console.log("[NO TOKEN] You did not provide any token. Make a .env file and add".green.bold,
"TOKEN=YOUR TOKEN".red.bold,
"in your.env file".green.bold);
return;
}
client.login(process.env.TOKEN)
.catch(e => console.log(`[DISCORD API] ${e}`.green.bold))