-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (34 loc) · 1.29 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
const { Client, GatewayIntentBits, Partials, Collection, WebhookClient, EmbedBuilder} = require('discord.js');
require("@colors/colors")
const mongoose = require('mongoose');
require('dotenv').config();
const Schema = require("./Database/guildConfigSchema");
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.MessageContent
],
partials: [Partials.Channel, Partials.Message, Partials.User, Partials.GuildMember, Partials.Reaction]
});
const fs = require('fs');
require('dotenv').config()
client.commands = new Collection()
client.aliases = new Collection()
client.slashCommands = new Collection();
client.buttons = new Collection();
client.prefix = process.env.PREFIX;
module.exports = client;
mongoose.set("strictQuery", true);
mongoose.connect(process.env.MONGOURL, {useNewUrlParser: true, useUnifiedTopology: true}).then(() => {
console.log("[ Database ] ".magenta + 'Connected to MongoDB')
}).catch((err) => {
console.log("[ Database ] ".red + 'Failed to connect to MongoDB')
})
fs.readdirSync('./handlers').forEach((handler) => {
require(`./handlers/${handler}`)(client)
});
client.login(process.env.TOKEN)