diff --git a/app.js b/app.js index 520604e..9692dd7 100644 --- a/app.js +++ b/app.js @@ -22,4 +22,5 @@ client.on(Events.ClientReady, () => { console.log(`Hello World !`); }); */ -client.login(process.env.DISCORDTOKEN); \ No newline at end of file + +// client.login(process.env.DISCORDTOKEN); \ No newline at end of file diff --git a/index.js b/index.js index 52b27a2..8c59afe 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,6 @@ import { Client, GatewayIntentBits, WebhookClient, AuditLogEvent, OAuth2Scopes, Options, Events } from 'discord.js'; import firstDetector from './detectors/allDetector.js'; - -// const webhookClient = process.env.LOGS_WEBHOOK ? new WebhookClient({ url: process.env.LOGS_WEBHOOK }) : null; +import 'dotenv/config'; const client = new Client({ makeCache: Options.cacheWithLimits({ @@ -14,32 +13,7 @@ const client = new Client({ ] }); -// Démarrage -client.on('ready', async () => { - console.log(`Logged in as ${client.user?.tag ?? 'unknown'}`); - - webhookClient?.send({ - content: `Logged in as ${client.user?.tag ?? 'unknown'}` - }); - - await client.guilds.fetch(); - - console.log('Bot is ready!'); - console.log(client.generateInvite({ - scopes: [OAuth2Scopes.Bot], - permissions: [ - 'SendMessages', - 'ViewAuditLog', - 'ViewChannel', - 'UseApplicationCommands', - 'EmbedLinks', - 'ReadMessageHistory' - ] - })); -}); - // Gestion des Messages (Listeners) - // Fonction locale pour traiter un message (remplace newMessageListener) async function handleMessage(message) { try { @@ -73,7 +47,7 @@ client.on('messageUpdate', async (oldMessage, newMessage) => { if (oldMessage.content === message.content) return; // Pas de changement de texte if (!message.content) return; - // Si l'ancien message déclenchait déjà un "quoi" (regex simple), on évite de spammer + // on évite de spammer if (oldMessage.content && oldMessage.content.match(/(\b|^)quoi(\b|$)/i)) { return; }