-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
69 lines (65 loc) · 2.61 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
const { Client, GatewayIntentBits, Partials } = require("discord.js");
const config = require("./config.js");
const fs = require("fs");
const client = new Client({
partials: [
Partials.Message, // for message
Partials.Channel, // for text channel
Partials.GuildMember, // for guild member
Partials.Reaction, // for message reaction
Partials.GuildScheduledEvent, // for guild events
Partials.User, // for discord user
Partials.ThreadMember, // for thread member
],
intents: [
GatewayIntentBits.Guilds, // for guild related things
GatewayIntentBits.GuildMembers, // for guild members related things
GatewayIntentBits.GuildBans, // for manage guild bans
GatewayIntentBits.GuildEmojisAndStickers, // for manage emojis and stickers
GatewayIntentBits.GuildIntegrations, // for discord Integrations
GatewayIntentBits.GuildWebhooks, // for discord webhooks
GatewayIntentBits.GuildInvites, // for guild invite managing
GatewayIntentBits.GuildVoiceStates, // for voice related things
GatewayIntentBits.GuildPresences, // for user presence things
GatewayIntentBits.GuildMessages, // for guild messages things
GatewayIntentBits.GuildMessageReactions, // for message reactions things
GatewayIntentBits.GuildMessageTyping, // for message typing things
GatewayIntentBits.DirectMessages, // for dm messages
GatewayIntentBits.DirectMessageReactions, // for dm message reaction
GatewayIntentBits.DirectMessageTyping, // for dm message typinh
GatewayIntentBits.MessageContent, // enable if you need message content things
],
});
module.exports = client;
fs.readdir("./events", (err, files) => {
if (err) throw err;
files.forEach((file) => {
if (!file.endsWith(".js")) return;
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
console.log(`👌 Loadded Event: ${eventName}`);
client.on(eventName, event.bind(null, client));
delete require.cache[require.resolve(`./events/${file}`)];
});
});
client.commands = [];
fs.readdir("./commands", (err, files) => {
if (err) throw err;
files.forEach(async (file) => {
if (!file.endsWith(".js")) return;
try {
let props = require(`./commands/${file}`);
client.commands.push({
name: props.name,
description: props.description,
options: props.options
});
console.log(`Loaded command: ${props.name}`);
} catch (err) {
console.log(err);
}
});
});
client.login(config.token || process.env.TOKEN).catch(e => {
console.log("The Bot Token You Entered Into Your Project Is Incorrect Or Your Bot's INTENTS Are OFF!")
})