33 lines
910 B
JavaScript
33 lines
910 B
JavaScript
require('dotenv').config();
|
|
const { Client, GatewayIntentBits } = require('discord.js');
|
|
const { loadCommands } = require('./src/handlers/commandHandler');
|
|
const { loadEvents } = require('./src/handlers/eventHandler');
|
|
|
|
const client = new Client({
|
|
intents: [
|
|
GatewayIntentBits.Guilds,
|
|
GatewayIntentBits.GuildMessages,
|
|
GatewayIntentBits.MessageContent,
|
|
GatewayIntentBits.GuildMembers
|
|
]
|
|
});
|
|
|
|
async function startBot() {
|
|
try {
|
|
console.log('🚀 Démarrage du bot...');
|
|
|
|
// Charger les commandes et événements
|
|
await loadCommands(client);
|
|
await loadEvents(client);
|
|
|
|
// Connexion du bot
|
|
await client.login(process.env.TOKEN);
|
|
|
|
console.log('✅ Bot connecté avec succès !');
|
|
} catch (error) {
|
|
console.error('❌ Erreur lors du démarrage du bot:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
startBot(); |