genius-troll/index.js

38 lines
1.1 KiB
JavaScript
Raw Normal View History

2025-11-20 21:59:42 +01:00
import 'dotenv/config';
2025-11-21 09:52:32 +01:00
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';
2025-11-20 20:21:04 +01:00
const client = new Client({
makeCache: Options.cacheWithLimits({
2025-11-21 09:52:32 +01:00
MessageManager: 0, // Très bien pour la RAM
// Ajoute ceci pour économiser encore plus :
UserManager: 0,
GuildMemberManager: 0,
ThreadManager: 0,
2025-11-20 20:21:04 +01:00
}),
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
]
});
2025-11-21 09:52:32 +01:00
client.on(Events.ClientReady, () => {
2025-11-20 22:33:51 +01:00
console.log(`[SUCCESS] Logged in as ${client.user?.tag}`);
});
2025-11-21 09:52:32 +01:00
client.on('messageCreate', async (message) => {
if (message.author.bot) return;
2025-11-20 22:33:51 +01:00
2025-11-20 20:21:04 +01:00
try {
2025-11-21 09:52:32 +01:00
const reply = await firstDetector.createReply(message); // Plus besoin de vérifier si firstDetector existe
if (reply) await message.reply(reply);
2025-11-20 20:21:04 +01:00
} catch (e) {
2025-11-21 09:52:32 +01:00
console.error('Erreur détecteur:', e);
2025-11-20 20:21:04 +01:00
}
});
2025-11-21 09:52:32 +01:00
// ... (Reste du code inchangé)
2025-11-20 20:21:04 +01:00
client.login(process.env.DISCORD_TOKEN);