-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
53 lines (46 loc) · 1.27 KB
/
index.js
File metadata and controls
53 lines (46 loc) · 1.27 KB
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
const { mongodb_srv, discord_token } = require("./config.json");
const colors = require("colors");
const {
Client,
Collection,
GatewayIntentBits,
Partials,
} = require("discord.js");
const fs = require("fs");
const mongoose = require("mongoose");
mongoose
.connect(mongodb_srv, {
useNewUrlParser: true,
useUnifiedTopology: true,
})
.then(() => {
console.log("Connected to the MongoDB database...".green);
})
.catch((err) => {
console.log(err);
});
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
partials: [Partials.Channel],
});
client.commands = new Collection();
const functions = fs
.readdirSync("./functions")
.filter((file) => file.endsWith(".js"));
const eventFiles = fs
.readdirSync("./events")
.filter((file) => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./commands");
(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./events");
client.handleCommands(commandFolders, "./commands");
client.login(discord_token);
})();