From 6de9768e3f7769364c6e72a54b2952e98fa0a9fa Mon Sep 17 00:00:00 2001 From: Arthur Puechberty Date: Sun, 18 Jan 2026 14:42:22 +0100 Subject: [PATCH] add categories and auto generating help commands --- app/commands/{ => 🎮 Général}/avatar.js | 2 +- app/commands/{ => 🎮 Général}/banner.js | 2 +- app/commands/{ => 🎮 Général}/botinfo.js | 2 +- app/commands/🎮 Général/help.js | 323 ++++++++++++++++++ app/commands/{ => 🎮 Général}/ping.js | 2 +- app/commands/{ => 🎮 Général}/serverinfo.js | 2 +- app/commands/{ => 🎮 Général}/uptime.js | 2 +- app/commands/{ => 🎮 Général}/userinfo.js | 2 +- app/commands/{ => 💰 Économie}/balance.js | 4 +- app/commands/{ => 💰 Économie}/crime.js | 4 +- app/commands/{ => 💰 Économie}/daily.js | 4 +- app/commands/{ => 💰 Économie}/deposit.js | 4 +- app/commands/{ => 💰 Économie}/pay.js | 4 +- app/commands/{ => 💰 Économie}/richest.js | 4 +- app/commands/{ => 💰 Économie}/steal.js | 4 +- app/commands/{ => 💰 Économie}/withdraw.js | 4 +- app/commands/{ => 💰 Économie}/work.js | 4 +- app/commands/{ => 📈 Niveaux}/adminAddXp.js | 4 +- .../{ => 📈 Niveaux}/adminRemoveXp.js | 4 +- app/commands/{ => 📈 Niveaux}/adminSetXp.js | 4 +- app/commands/{ => 📈 Niveaux}/level.js | 4 +- app/commands/{ => 📈 Niveaux}/leveltop.js | 4 +- app/commands/{ => 📦 Autres}/coinflip.js | 2 +- app/commands/{ => 📦 Autres}/stats.js | 4 +- .../{ => 🔧 Administration}/adminEcoAdd.js | 4 +- .../{ => 🔧 Administration}/adminEcoRemove.js | 4 +- .../{ => 🔧 Administration}/countingAdd.js | 4 +- .../{ => 🔧 Administration}/countingRemove.js | 4 +- .../{ => 🔧 Administration}/countingSet.js | 4 +- app/commands/{ => 🔧 Administration}/panel.js | 2 +- app/commands/{ => 🛡️ Modération}/ban.js | 2 +- app/commands/{ => 🛡️ Modération}/clear.js | 2 +- app/commands/{ => 🛡️ Modération}/kick.js | 2 +- app/commands/{ => 🛡️ Modération}/timeout.js | 2 +- app/commands/{ => 🛡️ Modération}/untimeout.js | 2 +- app/events/messageCreate.js | 21 ++ 36 files changed, 398 insertions(+), 54 deletions(-) rename app/commands/{ => 🎮 Général}/avatar.js (98%) rename app/commands/{ => 🎮 Général}/banner.js (97%) rename app/commands/{ => 🎮 Général}/botinfo.js (97%) create mode 100644 app/commands/🎮 Général/help.js rename app/commands/{ => 🎮 Général}/ping.js (98%) rename app/commands/{ => 🎮 Général}/serverinfo.js (98%) rename app/commands/{ => 🎮 Général}/uptime.js (96%) rename app/commands/{ => 🎮 Général}/userinfo.js (98%) rename app/commands/{ => 💰 Économie}/balance.js (97%) rename app/commands/{ => 💰 Économie}/crime.js (98%) rename app/commands/{ => 💰 Économie}/daily.js (97%) rename app/commands/{ => 💰 Économie}/deposit.js (97%) rename app/commands/{ => 💰 Économie}/pay.js (98%) rename app/commands/{ => 💰 Économie}/richest.js (96%) rename app/commands/{ => 💰 Économie}/steal.js (98%) rename app/commands/{ => 💰 Économie}/withdraw.js (97%) rename app/commands/{ => 💰 Économie}/work.js (97%) rename app/commands/{ => 📈 Niveaux}/adminAddXp.js (98%) rename app/commands/{ => 📈 Niveaux}/adminRemoveXp.js (98%) rename app/commands/{ => 📈 Niveaux}/adminSetXp.js (98%) rename app/commands/{ => 📈 Niveaux}/level.js (96%) rename app/commands/{ => 📈 Niveaux}/leveltop.js (97%) rename app/commands/{ => 📦 Autres}/coinflip.js (94%) rename app/commands/{ => 📦 Autres}/stats.js (99%) rename app/commands/{ => 🔧 Administration}/adminEcoAdd.js (97%) rename app/commands/{ => 🔧 Administration}/adminEcoRemove.js (97%) rename app/commands/{ => 🔧 Administration}/countingAdd.js (97%) rename app/commands/{ => 🔧 Administration}/countingRemove.js (97%) rename app/commands/{ => 🔧 Administration}/countingSet.js (97%) rename app/commands/{ => 🔧 Administration}/panel.js (97%) rename app/commands/{ => 🛡️ Modération}/ban.js (98%) rename app/commands/{ => 🛡️ Modération}/clear.js (98%) rename app/commands/{ => 🛡️ Modération}/kick.js (98%) rename app/commands/{ => 🛡️ Modération}/timeout.js (98%) rename app/commands/{ => 🛡️ Modération}/untimeout.js (98%) diff --git a/app/commands/avatar.js b/app/commands/🎮 Général/avatar.js similarity index 98% rename from app/commands/avatar.js rename to app/commands/🎮 Général/avatar.js index e1e1f16..745e069 100644 --- a/app/commands/avatar.js +++ b/app/commands/🎮 Général/avatar.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); module.exports = addCommand({ diff --git a/app/commands/banner.js b/app/commands/🎮 Général/banner.js similarity index 97% rename from app/commands/banner.js rename to app/commands/🎮 Général/banner.js index b86b617..ae9224d 100644 --- a/app/commands/banner.js +++ b/app/commands/🎮 Général/banner.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); module.exports = addCommand({ diff --git a/app/commands/botinfo.js b/app/commands/🎮 Général/botinfo.js similarity index 97% rename from app/commands/botinfo.js rename to app/commands/🎮 Général/botinfo.js index 0308260..ab6f10a 100644 --- a/app/commands/botinfo.js +++ b/app/commands/🎮 Général/botinfo.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); const os = require("os"); diff --git a/app/commands/🎮 Général/help.js b/app/commands/🎮 Général/help.js new file mode 100644 index 0000000..f94e880 --- /dev/null +++ b/app/commands/🎮 Général/help.js @@ -0,0 +1,323 @@ +const addCommand = require("../../fonctions/addCommand"); +const { + EmbedBuilder, + ButtonBuilder, + ButtonStyle, + ActionRowBuilder, +} = require("discord.js"); + +module.exports = addCommand({ + name: "help", + description: "Affiche la liste des commandes disponibles.", + aliases: ["h", "aide", "commands", "cmds"], + permissions: [], + botOwnerOnly: false, + dm: true, + executePrefix: async (client, message, args) => { + const prefix = "!"; + + // Si une commande spécifique est demandée + if (args[0]) { + const commandName = args[0].toLowerCase(); + const command = client.commands.get(commandName) || + client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)); + + if (!command) { + const embed = new EmbedBuilder() + .setTitle("❌ Commande introuvable") + .setDescription(`La commande \`${args[0]}\` n'existe pas.\nUtilise \`${prefix}help\` pour voir toutes les commandes.`) + .setColor("#ED4245") + .setTimestamp() + .setFooter({ + text: `Demandé par ${message.author.tag}`, + iconURL: message.author.displayAvatarURL({ dynamic: true }) + }); + + return message.reply({ embeds: [embed] }); + } + + // Vérifier si la commande est désactivée sur ce serveur + let isDisabled = false; + if (command.scope === "guild" && message.guild?.id && typeof command.guildCondition === "function") { + isDisabled = !(await command.guildCondition(message.guild.id)); + } + + const embed = new EmbedBuilder() + .setTitle(`📖 Commande: ${command.name}`) + .setDescription(command.description || "Pas de description.") + .setColor(isDisabled ? "#FFA500" : "#5865F2") + .addFields( + { name: "📁 Catégorie", value: command.category || "Autres", inline: true }, + { name: "🏷️ Aliases", value: command.aliases?.length > 0 ? command.aliases.map(a => `\`${a}\``).join(", ") : "Aucun", inline: true }, + { name: "💬 Utilisation", value: `\`${prefix}${command.name}\` ou \`/${command.name}\``, inline: false } + ) + .setTimestamp() + .setFooter({ + text: `Demandé par ${message.author.tag}`, + iconURL: message.author.displayAvatarURL({ dynamic: true }) + }); + + if (command.permissions?.length > 0) { + embed.addFields({ name: "🔒 Permissions requises", value: command.permissions.join(", "), inline: false }); + } + + if (isDisabled) { + embed.addFields({ name: "⚠️ Statut", value: "Cette commande est **désactivée** sur ce serveur.", inline: false }); + } + + return message.reply({ embeds: [embed] }); + } + + // Créer les pages d'aide + const pages = await createHelpPages(client, prefix, message.author, message.guild?.id); + let currentPage = 0; + + const row = createNavigationRow(currentPage, pages.length); + + const reply = await message.reply({ + embeds: [pages[0]], + components: [row] + }); + + const collector = reply.createMessageComponentCollector({ + filter: (i) => i.user.id === message.author.id, + time: 120000 + }); + + collector.on("collect", async (i) => { + if (i.customId === "help_first") currentPage = 0; + else if (i.customId === "help_prev") currentPage = Math.max(0, currentPage - 1); + else if (i.customId === "help_next") currentPage = Math.min(pages.length - 1, currentPage + 1); + else if (i.customId === "help_last") currentPage = pages.length - 1; + + await i.update({ + embeds: [pages[currentPage]], + components: [createNavigationRow(currentPage, pages.length)] + }); + }); + + collector.on("end", () => { + reply.edit({ components: [] }).catch(() => {}); + }); + }, + + executeSlash: async (client, interaction) => { + const commandOption = interaction.options.getString("commande"); + const prefix = "!"; + + // Si une commande spécifique est demandée + if (commandOption) { + const commandName = commandOption.toLowerCase(); + const command = client.commands.get(commandName) || + client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)); + + if (!command) { + const embed = new EmbedBuilder() + .setTitle("❌ Commande introuvable") + .setDescription(`La commande \`${commandOption}\` n'existe pas.\nUtilise \`/help\` pour voir toutes les commandes.`) + .setColor("#ED4245") + .setTimestamp() + .setFooter({ + text: `Demandé par ${interaction.user.tag}`, + iconURL: interaction.user.displayAvatarURL({ dynamic: true }) + }); + + return interaction.reply({ embeds: [embed], ephemeral: true }); + } + + // Vérifier si la commande est désactivée sur ce serveur + let isDisabled = false; + if (command.scope === "guild" && interaction.guild?.id && typeof command.guildCondition === "function") { + isDisabled = !(await command.guildCondition(interaction.guild.id)); + } + + const embed = new EmbedBuilder() + .setTitle(`📖 Commande: ${command.name}`) + .setDescription(command.description || "Pas de description.") + .setColor(isDisabled ? "#FFA500" : "#5865F2") + .addFields( + { name: "📁 Catégorie", value: command.category || "Autres", inline: true }, + { name: "🏷️ Aliases", value: command.aliases?.length > 0 ? command.aliases.map(a => `\`${a}\``).join(", ") : "Aucun", inline: true }, + { name: "💬 Utilisation", value: `\`${prefix}${command.name}\` ou \`/${command.name}\``, inline: false } + ) + .setTimestamp() + .setFooter({ + text: `Demandé par ${interaction.user.tag}`, + iconURL: interaction.user.displayAvatarURL({ dynamic: true }) + }); + + if (command.permissions?.length > 0) { + embed.addFields({ name: "🔒 Permissions requises", value: command.permissions.join(", "), inline: false }); + } + + if (isDisabled) { + embed.addFields({ name: "⚠️ Statut", value: "Cette commande est **désactivée** sur ce serveur.", inline: false }); + } + + return interaction.reply({ embeds: [embed] }); + } + + // Créer les pages d'aide + const pages = await createHelpPages(client, prefix, interaction.user, interaction.guild?.id); + let currentPage = 0; + + const row = createNavigationRow(currentPage, pages.length); + + const reply = await interaction.reply({ + embeds: [pages[0]], + components: [row], + fetchReply: true + }); + + const collector = reply.createMessageComponentCollector({ + filter: (i) => i.user.id === interaction.user.id, + time: 120000 + }); + + collector.on("collect", async (i) => { + if (i.customId === "help_first") currentPage = 0; + else if (i.customId === "help_prev") currentPage = Math.max(0, currentPage - 1); + else if (i.customId === "help_next") currentPage = Math.min(pages.length - 1, currentPage + 1); + else if (i.customId === "help_last") currentPage = pages.length - 1; + + await i.update({ + embeds: [pages[currentPage]], + components: [createNavigationRow(currentPage, pages.length)] + }); + }); + + collector.on("end", () => { + interaction.editReply({ components: [] }).catch(() => {}); + }); + }, + + slashOptions: [ + { + type: "STRING", + name: "commande", + description: "Le nom de la commande pour obtenir plus d'informations", + required: false + } + ] +}); + +async function createHelpPages(client, prefix, user, guildId) { + const pages = []; + + // Récupérer toutes les catégories dynamiquement + const categories = new Map(); + + // Filtrer les commandes selon leur scope et guildCondition + for (const [, cmd] of client.commands) { + // Si la commande a scope "guild", vérifier la condition + if (cmd.scope === "guild" && guildId && typeof cmd.guildCondition === "function") { + const isEnabled = await cmd.guildCondition(guildId); + if (!isEnabled) continue; // Ne pas ajouter cette commande + } + + const category = cmd.category || "📦 Autres"; + if (!categories.has(category)) { + categories.set(category, []); + } + categories.get(category).push(cmd); + } + + // Supprimer les catégories vides + for (const [category, cmds] of categories) { + if (cmds.length === 0) { + categories.delete(category); + } + } + + // Compter le total de commandes visibles + let totalCommands = 0; + categories.forEach(cmds => totalCommands += cmds.length); + + // Page d'accueil + const categoryList = Array.from(categories.keys()).map(c => `> ${c}`).join("\n"); + + const welcomeEmbed = new EmbedBuilder() + .setTitle("📚 Centre d'aide - LazyBot") + .setDescription( + `Bienvenue dans le centre d'aide de **LazyBot** !\n\n` + + `🔹 Utilise les boutons pour naviguer entre les pages\n` + + `🔹 Utilise \`${prefix}help \` ou \`/help commande:\` pour plus de détails\n\n` + + `**📊 Statistiques**\n` + + `> Commandes disponibles: **${totalCommands}**\n` + + `> Catégories: **${categories.size}**` + ) + .setColor("#5865F2") + .setThumbnail(client.user.displayAvatarURL({ dynamic: true, size: 256 })) + .addFields({ + name: "📑 Catégories", + value: categoryList || "Aucune catégorie", + inline: false + }) + .setTimestamp() + .setFooter({ + text: `Page 1/${categories.size + 1} • Demandé par ${user.tag}`, + iconURL: user.displayAvatarURL({ dynamic: true }) + }); + + pages.push(welcomeEmbed); + + // Pages par catégorie + let pageNum = 2; + for (const [category, commands] of categories) { + if (commands.length === 0) continue; + + const commandList = commands.map(cmd => { + const aliases = cmd.aliases?.length > 0 ? ` *(${cmd.aliases.join(", ")})*` : ""; + return `> \`${prefix}${cmd.name}\`${aliases}\n> ┗ ${cmd.description || "Pas de description"}`; + }).join("\n\n"); + + const categoryEmbed = new EmbedBuilder() + .setTitle(category) + .setDescription(commandList || "Aucune commande dans cette catégorie.") + .setColor("#5865F2") + .setTimestamp() + .setFooter({ + text: `Page ${pageNum}/${categories.size + 1} • Demandé par ${user.tag}`, + iconURL: user.displayAvatarURL({ dynamic: true }) + }); + + pages.push(categoryEmbed); + pageNum++; + } + + return pages; +} + +function createNavigationRow(currentPage, totalPages) { + const firstButton = new ButtonBuilder() + .setCustomId("help_first") + .setEmoji("⏮️") + .setStyle(ButtonStyle.Secondary) + .setDisabled(currentPage === 0); + + const prevButton = new ButtonBuilder() + .setCustomId("help_prev") + .setEmoji("◀️") + .setStyle(ButtonStyle.Primary) + .setDisabled(currentPage === 0); + + const pageIndicator = new ButtonBuilder() + .setCustomId("help_page") + .setLabel(`${currentPage + 1}/${totalPages}`) + .setStyle(ButtonStyle.Secondary) + .setDisabled(true); + + const nextButton = new ButtonBuilder() + .setCustomId("help_next") + .setEmoji("▶️") + .setStyle(ButtonStyle.Primary) + .setDisabled(currentPage === totalPages - 1); + + const lastButton = new ButtonBuilder() + .setCustomId("help_last") + .setEmoji("⏭️") + .setStyle(ButtonStyle.Secondary) + .setDisabled(currentPage === totalPages - 1); + + return new ActionRowBuilder().addComponents(firstButton, prevButton, pageIndicator, nextButton, lastButton); +} diff --git a/app/commands/ping.js b/app/commands/🎮 Général/ping.js similarity index 98% rename from app/commands/ping.js rename to app/commands/🎮 Général/ping.js index 4e11c8f..5cd5441 100644 --- a/app/commands/ping.js +++ b/app/commands/🎮 Général/ping.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { SlashCommandBuilder, ButtonStyle, diff --git a/app/commands/serverinfo.js b/app/commands/🎮 Général/serverinfo.js similarity index 98% rename from app/commands/serverinfo.js rename to app/commands/🎮 Général/serverinfo.js index 7c79750..8742add 100644 --- a/app/commands/serverinfo.js +++ b/app/commands/🎮 Général/serverinfo.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, ChannelType } = require("discord.js"); module.exports = addCommand({ diff --git a/app/commands/uptime.js b/app/commands/🎮 Général/uptime.js similarity index 96% rename from app/commands/uptime.js rename to app/commands/🎮 Général/uptime.js index bda7e73..398b156 100644 --- a/app/commands/uptime.js +++ b/app/commands/🎮 Général/uptime.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); module.exports = addCommand({ diff --git a/app/commands/userinfo.js b/app/commands/🎮 Général/userinfo.js similarity index 98% rename from app/commands/userinfo.js rename to app/commands/🎮 Général/userinfo.js index 280b2c7..7e55294 100644 --- a/app/commands/userinfo.js +++ b/app/commands/🎮 Général/userinfo.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); module.exports = addCommand({ diff --git a/app/commands/balance.js b/app/commands/💰 Économie/balance.js similarity index 97% rename from app/commands/balance.js rename to app/commands/💰 Économie/balance.js index 0f45171..647b24b 100644 --- a/app/commands/balance.js +++ b/app/commands/💰 Économie/balance.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "balance", diff --git a/app/commands/crime.js b/app/commands/💰 Économie/crime.js similarity index 98% rename from app/commands/crime.js rename to app/commands/💰 Économie/crime.js index 568f9d6..30f9ac3 100644 --- a/app/commands/crime.js +++ b/app/commands/💰 Économie/crime.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); const crimeSuccessMessages = [ "Vous avez cambriolé une maison et volé", diff --git a/app/commands/daily.js b/app/commands/💰 Économie/daily.js similarity index 97% rename from app/commands/daily.js rename to app/commands/💰 Économie/daily.js index 5c1deb1..4bf70ce 100644 --- a/app/commands/daily.js +++ b/app/commands/💰 Économie/daily.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "daily", diff --git a/app/commands/deposit.js b/app/commands/💰 Économie/deposit.js similarity index 97% rename from app/commands/deposit.js rename to app/commands/💰 Économie/deposit.js index 695cb5d..701928b 100644 --- a/app/commands/deposit.js +++ b/app/commands/💰 Économie/deposit.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "deposit", diff --git a/app/commands/pay.js b/app/commands/💰 Économie/pay.js similarity index 98% rename from app/commands/pay.js rename to app/commands/💰 Économie/pay.js index 2cfbb1a..692986a 100644 --- a/app/commands/pay.js +++ b/app/commands/💰 Économie/pay.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "pay", diff --git a/app/commands/richest.js b/app/commands/💰 Économie/richest.js similarity index 96% rename from app/commands/richest.js rename to app/commands/💰 Économie/richest.js index 23085a3..83dc6a4 100644 --- a/app/commands/richest.js +++ b/app/commands/💰 Économie/richest.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "richest", diff --git a/app/commands/steal.js b/app/commands/💰 Économie/steal.js similarity index 98% rename from app/commands/steal.js rename to app/commands/💰 Économie/steal.js index c626ad1..208eb94 100644 --- a/app/commands/steal.js +++ b/app/commands/💰 Économie/steal.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); const stealSuccessMessages = [ "Vous avez subtilement volé", diff --git a/app/commands/withdraw.js b/app/commands/💰 Économie/withdraw.js similarity index 97% rename from app/commands/withdraw.js rename to app/commands/💰 Économie/withdraw.js index 3d3ef30..12b9b4a 100644 --- a/app/commands/withdraw.js +++ b/app/commands/💰 Économie/withdraw.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "withdraw", diff --git a/app/commands/work.js b/app/commands/💰 Économie/work.js similarity index 97% rename from app/commands/work.js rename to app/commands/💰 Économie/work.js index 91558f4..cc7fdb7 100644 --- a/app/commands/work.js +++ b/app/commands/💰 Économie/work.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); const workMessages = [ "Vous avez travaillé comme serveur et gagné", diff --git a/app/commands/adminAddXp.js b/app/commands/📈 Niveaux/adminAddXp.js similarity index 98% rename from app/commands/adminAddXp.js rename to app/commands/📈 Niveaux/adminAddXp.js index cee55c5..eb66d32 100644 --- a/app/commands/adminAddXp.js +++ b/app/commands/📈 Niveaux/adminAddXp.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "adminaddxp", diff --git a/app/commands/adminRemoveXp.js b/app/commands/📈 Niveaux/adminRemoveXp.js similarity index 98% rename from app/commands/adminRemoveXp.js rename to app/commands/📈 Niveaux/adminRemoveXp.js index 4da44fd..e4ff36e 100644 --- a/app/commands/adminRemoveXp.js +++ b/app/commands/📈 Niveaux/adminRemoveXp.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "adminremovexp", diff --git a/app/commands/adminSetXp.js b/app/commands/📈 Niveaux/adminSetXp.js similarity index 98% rename from app/commands/adminSetXp.js rename to app/commands/📈 Niveaux/adminSetXp.js index 8f6cf31..ca2a914 100644 --- a/app/commands/adminSetXp.js +++ b/app/commands/📈 Niveaux/adminSetXp.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "adminsetxp", diff --git a/app/commands/level.js b/app/commands/📈 Niveaux/level.js similarity index 96% rename from app/commands/level.js rename to app/commands/📈 Niveaux/level.js index a35d3cd..f61fe67 100644 --- a/app/commands/level.js +++ b/app/commands/📈 Niveaux/level.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "level", diff --git a/app/commands/leveltop.js b/app/commands/📈 Niveaux/leveltop.js similarity index 97% rename from app/commands/leveltop.js rename to app/commands/📈 Niveaux/leveltop.js index 6e5beb7..1104e5d 100644 --- a/app/commands/leveltop.js +++ b/app/commands/📈 Niveaux/leveltop.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, SlashCommandBuilder } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "leveltop", diff --git a/app/commands/coinflip.js b/app/commands/📦 Autres/coinflip.js similarity index 94% rename from app/commands/coinflip.js rename to app/commands/📦 Autres/coinflip.js index 8af988d..380150c 100644 --- a/app/commands/coinflip.js +++ b/app/commands/📦 Autres/coinflip.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder } = require("discord.js"); module.exports = addCommand({ diff --git a/app/commands/stats.js b/app/commands/📦 Autres/stats.js similarity index 99% rename from app/commands/stats.js rename to app/commands/📦 Autres/stats.js index 94bbf36..0c6bba9 100644 --- a/app/commands/stats.js +++ b/app/commands/📦 Autres/stats.js @@ -1,6 +1,6 @@ const { EmbedBuilder, AttachmentBuilder } = require("discord.js"); -const addCommand = require("../fonctions/addCommand"); -const db = require("../db"); +const addCommand = require("../../fonctions/addCommand"); +const db = require("../../db"); const { ChartJSNodeCanvas } = require('chartjs-node-canvas'); // Créer le renderer de graphique diff --git a/app/commands/adminEcoAdd.js b/app/commands/🔧 Administration/adminEcoAdd.js similarity index 97% rename from app/commands/adminEcoAdd.js rename to app/commands/🔧 Administration/adminEcoAdd.js index edf9f73..d5d2dfe 100644 --- a/app/commands/adminEcoAdd.js +++ b/app/commands/🔧 Administration/adminEcoAdd.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "adminecoadd", diff --git a/app/commands/adminEcoRemove.js b/app/commands/🔧 Administration/adminEcoRemove.js similarity index 97% rename from app/commands/adminEcoRemove.js rename to app/commands/🔧 Administration/adminEcoRemove.js index 7bd1f96..cd5c56c 100644 --- a/app/commands/adminEcoRemove.js +++ b/app/commands/🔧 Administration/adminEcoRemove.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "adminecoremove", diff --git a/app/commands/countingAdd.js b/app/commands/🔧 Administration/countingAdd.js similarity index 97% rename from app/commands/countingAdd.js rename to app/commands/🔧 Administration/countingAdd.js index a9ce403..6a1eee8 100644 --- a/app/commands/countingAdd.js +++ b/app/commands/🔧 Administration/countingAdd.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "counting-add", diff --git a/app/commands/countingRemove.js b/app/commands/🔧 Administration/countingRemove.js similarity index 97% rename from app/commands/countingRemove.js rename to app/commands/🔧 Administration/countingRemove.js index 69e3a40..533d288 100644 --- a/app/commands/countingRemove.js +++ b/app/commands/🔧 Administration/countingRemove.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "counting-remove", diff --git a/app/commands/countingSet.js b/app/commands/🔧 Administration/countingSet.js similarity index 97% rename from app/commands/countingSet.js rename to app/commands/🔧 Administration/countingSet.js index eb5331d..1e9e867 100644 --- a/app/commands/countingSet.js +++ b/app/commands/🔧 Administration/countingSet.js @@ -1,6 +1,6 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); -const db = require("../db"); +const db = require("../../db"); module.exports = addCommand({ name: "counting-set", diff --git a/app/commands/panel.js b/app/commands/🔧 Administration/panel.js similarity index 97% rename from app/commands/panel.js rename to app/commands/🔧 Administration/panel.js index ea718f4..a067d61 100644 --- a/app/commands/panel.js +++ b/app/commands/🔧 Administration/panel.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require("discord.js"); module.exports = addCommand({ diff --git a/app/commands/ban.js b/app/commands/🛡️ Modération/ban.js similarity index 98% rename from app/commands/ban.js rename to app/commands/🛡️ Modération/ban.js index de2e4f7..7e3fada 100644 --- a/app/commands/ban.js +++ b/app/commands/🛡️ Modération/ban.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); module.exports = addCommand({ diff --git a/app/commands/clear.js b/app/commands/🛡️ Modération/clear.js similarity index 98% rename from app/commands/clear.js rename to app/commands/🛡️ Modération/clear.js index 185a9ed..c27c360 100644 --- a/app/commands/clear.js +++ b/app/commands/🛡️ Modération/clear.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); module.exports = addCommand({ diff --git a/app/commands/kick.js b/app/commands/🛡️ Modération/kick.js similarity index 98% rename from app/commands/kick.js rename to app/commands/🛡️ Modération/kick.js index 4079423..537b114 100644 --- a/app/commands/kick.js +++ b/app/commands/🛡️ Modération/kick.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); module.exports = addCommand({ diff --git a/app/commands/timeout.js b/app/commands/🛡️ Modération/timeout.js similarity index 98% rename from app/commands/timeout.js rename to app/commands/🛡️ Modération/timeout.js index 8f854b8..7bfa0d0 100644 --- a/app/commands/timeout.js +++ b/app/commands/🛡️ Modération/timeout.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); module.exports = addCommand({ diff --git a/app/commands/untimeout.js b/app/commands/🛡️ Modération/untimeout.js similarity index 98% rename from app/commands/untimeout.js rename to app/commands/🛡️ Modération/untimeout.js index 9506c8b..c810351 100644 --- a/app/commands/untimeout.js +++ b/app/commands/🛡️ Modération/untimeout.js @@ -1,4 +1,4 @@ -const addCommand = require("../fonctions/addCommand"); +const addCommand = require("../../fonctions/addCommand"); const { EmbedBuilder, PermissionFlagsBits } = require("discord.js"); module.exports = addCommand({ diff --git a/app/events/messageCreate.js b/app/events/messageCreate.js index 8abef03..ba698c9 100644 --- a/app/events/messageCreate.js +++ b/app/events/messageCreate.js @@ -9,6 +9,27 @@ module.exports = { const guildId = message.guild.id; const userId = message.author.id; + // ===== BOT MENTION RESPONSE ===== + if (message.mentions.has(client.user) && !message.content.startsWith('!') && !message.content.startsWith('/')) { + // Vérifier que ce n'est pas juste une réponse à un message du bot + if (message.type !== 19 || message.mentions.users.first()?.id === client.user.id) { + const responses = [ + `Hey ${message.author} ! 👋 Besoin d'aide ? Utilise \`/help\` pour voir mes commandes !`, + `Salut ${message.author} ! 😊 Tu m'as appelé ? Tape \`/help\` pour découvrir ce que je peux faire !`, + `Coucou ${message.author} ! ✨ Je suis là pour t'aider ! Essaie \`/help\` pour commencer.`, + `Yo ${message.author} ! 🎉 Tu voulais me parler ? Utilise \`/help\` pour voir toutes mes commandes !`, + `${message.author} ! 👀 Oui oui, je suis bien là ! N'hésite pas à utiliser \`/help\` si tu as besoin de moi.` + ]; + const randomResponse = responses[Math.floor(Math.random() * responses.length)]; + + await message.reply({ + content: randomResponse, + allowedMentions: { repliedUser: true } + }); + return; + } + } + // ===== TRACK MESSAGE STATS ===== const today = new Date().toISOString().split('T')[0]; // YYYY-MM-DD db.run(