-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (28 loc) · 1.17 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
const { Client } = require('discord.js');
require('dotenv').config();
const { loadAllCommands } = require('./handlers/commandHandler');
const readyHandler = require('./events/ready');
const interactionCreateHandler = require('./events/interactionCreate');
const messageEventsHandler = require('./events/messageEvents');
const { loadButtons } = require('./handlers/buttonHandler');
const { loadSelectMenus } = require('./handlers/selectMenuHandler');
const { loadModals } = require('./handlers/modalHandler');
const connectDB = require('./utils/database');
const client = new Client({
intents: 3272703
});
// Conectar a la base de datos MongoDB
connectDB();
readyHandler(client);
interactionCreateHandler(client);
messageEventsHandler(client);
// Cargar comandos, botones y menús desplegables
loadAllCommands(client);
loadButtons(client); // Cargar los manejadores de botones
loadSelectMenus(client); // Cargar los manejadores de menús desplegables
loadModals(client); // Cargar los manejadores de modales
client.on('error', (error) =>{
console.log("Hay un error del bot en:", error)
});
// Iniciar sesión en Discord con el token del bot
client.login(process.env.DISCORD_TOKEN);