Update Bot

This commit is contained in:
2026-03-15 11:58:43 +01:00
parent b67c111ffc
commit cd99275933
560 changed files with 23173 additions and 55113 deletions

View File

@@ -8,19 +8,19 @@ const chalk = require('chalk');
const token = process.env.TOKEN;
if (!token) {
console.error(chalk.red('❌ Le token Discord n\'est pas défini dans les variables d\'environnement !'));
process.exit(1);
console.error(chalk.red('❌ Le token Discord n\'est pas défini dans les variables d\'environnement !'));
process.exit(1);
}
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildVoiceStates,
],
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildVoiceStates,
],
});
const db = require('./functions/database/db.js');
@@ -40,15 +40,11 @@ for (const folder of commandFolders) {
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
try {
const command = require(filePath);
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
} else {
console.warn(chalk.yellow(`⚠️ La commande à ${filePath} manque une propriété requise "data" ou "execute".`));
}
} catch (error) {
console.error(chalk.red(`❌ Erreur lors du chargement de la commande à ${filePath}:`), error);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
} else {
console.warn(chalk.yellow(`⚠️ La commande à ${filePath} manque une propriété requise "data" ou "execute".`));
}
}
}
@@ -58,19 +54,15 @@ const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'
for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
try {
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
} catch (error) {
console.error(chalk.red(`❌ Erreur lors du chargement de l'événement à ${filePath}:`), error);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
client.login(token).catch(err => {
console.error(chalk.red('❌ Erreur lors de la connexion:'), err);
process.exit(1);
console.error(chalk.red('❌ Erreur lors de la connexion:'), err);
process.exit(1);
});