-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
34 lines (29 loc) · 1004 Bytes
/
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
const { Client, IntentsBitField, Options, Collection } = require('discord.js');
const Discord = require('discord.js')
const mongoose = require('mongoose');
const eventHandler = require('./handlers/eventHandler');
require('dotenv').config()
const client = new Client({
partials: ['message', 'channel', 'reaction', 'guild', 'interaction', 'member', 'role'],
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.MessageContent,
],
makeCache: Options.cacheWithLimits(Options.DefaultMakeCacheSettings),
disableMentions: 'all',
});
client.commands = new Collection();
client.events = new Collection();
(async () => {
try {
mongoose.set('strictQuery', false);
await mongoose.connect(process.env.MONGO_URI);
console.log('Connected to Mongo DB');
eventHandler(client, Discord);
client.login(process.env.TOKEN);
} catch (error) {
console.log(`Error: ${error}`);
}
})();