-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
39 lines (29 loc) · 1.16 KB
/
bot.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
const discord = require('discord.js');
require('dotenv').config();
const botToken = process.env.BOT_TOKEN
const varHandl = require("./handlers/VariableHandler")
const dbManager = require("./modules/database")
const { rCache } = require('./modules/redisController')
//Create new DC Client and assign Flags
const client = new discord.Client({
partials: ['CHANNEL'],
intents: [discord.Intents.FLAGS.GUILDS, discord.Intents.FLAGS.GUILD_MEMBERS, discord.Intents.FLAGS.DIRECT_MESSAGES, discord.Intents.FLAGS.GUILD_VOICE_STATES, discord.Intents.FLAGS.GUILD_INVITES,]
});
//Set Client Variable
varHandl.set('client', client)
//Load EventHandler
require('./handlers/EventHandler').init(client)
//Load distubeHandler
require('./handlers/distubeHandler')
//Load buttonHandler
require('./handlers/buttonHandler')(client)
//Load selectMenuHandler
require('./handlers/selectMenuHandler')(client)
//Prepare Database
dbManager.stats.prepareDB()
client.login(botToken).then(async () => {
const redisClient = await new rCache().init()
varHandl.set('redisClient', redisClient)
//load commandHandler after redis is done
require('./handlers/CommandHandler')(client)
})