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 'dotenv/config';
|
||||||
import { Client, GatewayIntentBits, Options, Events } from 'discord.js';
|
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';
|
import firstDetector from './detectors/allDetector.js';
|
||||||
|
|
||||||
const client = new Client({
|
const client = new Client({
|
||||||
makeCache: Options.cacheWithLimits({
|
makeCache: Options.cacheWithLimits({
|
||||||
MessageManager: 0, //opti de RAM
|
MessageManager: 5, // opti de RAM mais 0 est trop agressif
|
||||||
UserManager: 0,
|
ThreadManager: 0, // peut rester a 0 car peu utilisé
|
||||||
GuildMemberManager: 0,
|
// commentées pour laisser par défaut, pas d'impact vu la RAM dispo
|
||||||
ThreadManager: 0,
|
// UserManager: 0,
|
||||||
|
//ThreadManager: 0,
|
||||||
}),
|
}),
|
||||||
intents: [
|
intents: [
|
||||||
GatewayIntentBits.Guilds,
|
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) => {
|
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;
|
if (message.author.bot) return;
|
||||||
|
|
||||||
try {
|
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);
|
if (reply) await message.reply(reply);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Erreur détecteur:', 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