feur fonctionnel
This commit is contained in:
parent
65e09de7e2
commit
f3377cd30c
1 changed files with 13 additions and 12 deletions
25
index.js
25
index.js
|
|
@ -1,14 +1,14 @@
|
|||
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,
|
||||
MessageManager: 5, // opti de RAM mais 0 est trop agressif
|
||||
ThreadManager: 0, // peut rester a 0 car peu utilisé
|
||||
// commentées pour laisser par défaut, pas d'impact vu la RAM dispo
|
||||
// UserManager: 0,
|
||||
//ThreadManager: 0,
|
||||
}),
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
|
|
@ -17,21 +17,22 @@ const client = new Client({
|
|||
]
|
||||
});
|
||||
|
||||
client.on(Events.ClientReady, () => {
|
||||
console.log(`[SUCCESS] Logged in as ${client.user?.tag}`);
|
||||
});
|
||||
|
||||
client.on('messageCreate', async (message) => {
|
||||
// DEBUG : Vérifie si le message arrive bien
|
||||
console.log(`[DEBUG] Message reçu de ${message.author?.tag}: ${message.content}`);
|
||||
|
||||
if (message.author.bot) return;
|
||||
|
||||
try {
|
||||
const reply = await firstDetector.createReply(message); // Plus besoin de vérifier si firstDetector existe
|
||||
const reply = await firstDetector.createReply(message);
|
||||
if (reply) await message.reply(reply);
|
||||
} catch (e) {
|
||||
console.error('Erreur détecteur:', e);
|
||||
}
|
||||
});
|
||||
|
||||
// ... (Reste du code inchangé)
|
||||
client.login(process.env.DISCORD_TOKEN);
|
||||
|
||||
client.login(process.env.DISCORD_TOKEN);
|
||||
client.on(Events.ClientReady, () => {
|
||||
console.log(`[SUCCESS] Logged in as ${client.user?.tag}`); //check co Discord
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue