37 lines
No EOL
1 KiB
JavaScript
37 lines
No EOL
1 KiB
JavaScript
import 'dotenv/config';
|
|
import { Client, GatewayIntentBits, Options, Events } from 'discord.js';
|
|
// Import statique : si ça plante ici (RAM), tu le sauras tout de suite
|
|
import firstDetector from './detectors/allDetector.js';
|
|
|
|
const client = new Client({
|
|
makeCache: Options.cacheWithLimits({
|
|
MessageManager: 0, //opti de RAM
|
|
UserManager: 0,
|
|
GuildMemberManager: 0,
|
|
ThreadManager: 0,
|
|
}),
|
|
intents: [
|
|
GatewayIntentBits.Guilds,
|
|
GatewayIntentBits.GuildMessages,
|
|
GatewayIntentBits.MessageContent,
|
|
]
|
|
});
|
|
|
|
client.on(Events.ClientReady, () => {
|
|
console.log(`[SUCCESS] Logged in as ${client.user?.tag}`);
|
|
});
|
|
|
|
client.on('messageCreate', async (message) => {
|
|
if (message.author.bot) return;
|
|
|
|
try {
|
|
const reply = await firstDetector.createReply(message); // Plus besoin de vérifier si firstDetector existe
|
|
if (reply) await message.reply(reply);
|
|
} catch (e) {
|
|
console.error('Erreur détecteur:', e);
|
|
}
|
|
});
|
|
|
|
// ... (Reste du code inchangé)
|
|
|
|
client.login(process.env.DISCORD_TOKEN); |