-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
57 lines (52 loc) · 1.5 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
const { Client, Message, MessageEmbed, Collection } = require("discord.js");
const colors = require("colors");
const fs = require("fs");
const client = new Client({
messageCacheLifetime: 60,
fetchAllMembers: false,
messageCacheMaxSize: 10,
restTimeOffset: 0,
restWsBridgetimeout: 100,
shards: "auto",
allowedMentions: {
parse: ["roles", "users", "everyone"],
repliedUser: true,
},
partials: ["MESSAGE", "CHANNEL", "REACTION"],
intents: [
"GUILDS",
"GUILD_MEMBERS",
"GUILD_BANS",
"GUILD_EMOJIS_AND_STICKERS",
"GUILD_MESSAGE_REACTIONS",
"GUILD_MESSAGES",
],
});
module.exports = client;
const config = require("./config/config.json");
const db = require("./tools/database.js");
client.db = db;
const mongoose = require("mongoose");
mongoose
.connect(config.mongooseConnectionString, {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true,
})
.then(console.log("MongoDB Conneted.."));
const prefix = config.prefix;
const token = config.token;
// Global Variables
client.commands = new Collection();
client.aliases = new Collection();
client.events = new Collection();
client.cooldowns = new Collection();
client.slashCommands = new Collection();
client.categories = fs.readdirSync("./commands/");
// Initializing the project
//Loading files, with the client variable like Command Handler, Event Handler, ...
["command"].forEach((handler) => {
require(`./handler/${handler}`)(client);
});
client.login(token);