diff --git a/commands/antiraid/bunker.js b/commands/antiraid/bunker.js index 1833cb5..dd7a717 100644 --- a/commands/antiraid/bunker.js +++ b/commands/antiraid/bunker.js @@ -1,6 +1,7 @@ module.exports = { name: 'bunker', description: 'Activer le bot bunker', + category: 'antiraid', async execute(message, args, client) { const guild = message.guild; const dangerousPermissions = [ diff --git a/commands/botcontrol/invite.js b/commands/botcontrol/invite.js index b0ba789..77d2c67 100644 --- a/commands/botcontrol/invite.js +++ b/commands/botcontrol/invite.js @@ -3,6 +3,7 @@ const { PermissionsBitField } = require('discord.js'); module.exports = { name: 'invite', description: 'Crée un lien d\'invitation pour un serveur spécifique', + category: 'botcontrol', async execute(message, args, client) { // Vérifie si l'ID du serveur a été fourni if (!args[0]) { diff --git a/commands/botcontrol/listen.js b/commands/botcontrol/listen.js index d3ca417..a54abae 100644 --- a/commands/botcontrol/listen.js +++ b/commands/botcontrol/listen.js @@ -3,6 +3,7 @@ const { ActivityType } = require("discord.js"); module.exports = { name: 'listen', description: 'Changer le status du bot en listen', + category: 'botcontrol', async execute(message, args, client) { const streamText = args.join(' ') || 'Streaming'; const streamURL = 'https://www.twitch.tv/valou336_yt'; diff --git a/commands/botcontrol/play.js b/commands/botcontrol/play.js index 94a2861..ea1f0a0 100644 --- a/commands/botcontrol/play.js +++ b/commands/botcontrol/play.js @@ -3,6 +3,7 @@ const { ActivityType } = require("discord.js"); module.exports = { name: 'play', description: 'Changer le status du bot en play', + category: 'botcontrol', async execute(message, args, client) { const streamText = args.join(' ') || 'Streaming'; const streamURL = 'https://www.twitch.tv/valou336_yt'; diff --git a/commands/botcontrol/say.js b/commands/botcontrol/say.js index dce3171..c287769 100644 --- a/commands/botcontrol/say.js +++ b/commands/botcontrol/say.js @@ -1,6 +1,7 @@ module.exports = { name: 'say', description: 'Fait dire quelque chose au bot', + category: 'botcontrol', async execute(message, args) { // Vérifie si un message a été spécifié if (args.length === 0) { diff --git a/commands/botcontrol/servers.js b/commands/botcontrol/servers.js index 9b0867b..d25ea4d 100644 --- a/commands/botcontrol/servers.js +++ b/commands/botcontrol/servers.js @@ -5,6 +5,7 @@ const path = require('path'); module.exports = { name: 'servers', description: 'Liste les serveur du bot', + category: 'botcontrol', async execute(message, args, client) { const guilds = Array.from(client.guilds.cache.values()).map((guild, index) => `${index + 1}. ${guild.name} : ${guild.id}`).join("\n\n"); diff --git a/commands/botcontrol/set.js b/commands/botcontrol/set.js index 9003bfe..79b822b 100644 --- a/commands/botcontrol/set.js +++ b/commands/botcontrol/set.js @@ -1,6 +1,7 @@ module.exports = { name: 'set', description: 'Modifier divers paramètres du bot.', + category: 'botcontrol', async execute(message, args, client) { // Vérifiez si l'utilisateur a fourni suffisamment d'arguments if (args.length < 2) { diff --git a/commands/botcontrol/stream.js b/commands/botcontrol/stream.js index 65d9bf2..f38cbc1 100644 --- a/commands/botcontrol/stream.js +++ b/commands/botcontrol/stream.js @@ -3,6 +3,7 @@ const { ActivityType } = require("discord.js"); module.exports = { name: 'stream', description: 'Mettre le bot en stream', + category: 'botcontrol', async execute(message, args, client) { const streamText = args.join(' ') || 'Streaming'; const streamURL = 'https://www.twitch.tv/valou336_yt'; diff --git a/commands/botcontrol/watch.js b/commands/botcontrol/watch.js index 17c6b77..9346087 100644 --- a/commands/botcontrol/watch.js +++ b/commands/botcontrol/watch.js @@ -3,6 +3,7 @@ const { ActivityType } = require("discord.js"); module.exports = { name: 'watch', description: 'Changer le status du bot en watch', + category: 'botcontrol', async execute(message, args, client) { const streamText = args.join(' ') || 'Streaming'; const streamURL = 'https://www.twitch.tv/valou336_yt'; diff --git a/commands/game/2048.js b/commands/game/2048.js index fcd1527..490980c 100644 --- a/commands/game/2048.js +++ b/commands/game/2048.js @@ -3,6 +3,7 @@ const { TwoZeroFourEight } = require('discord-gamecord'); module.exports = { name: '2048', description: 'Jouer au jeu 2048', + category: 'game', async execute(message, args) { const Game = new TwoZeroFourEight({ message: message, diff --git a/commands/game/8ball.js b/commands/game/8ball.js index 1c50bdb..8e25659 100644 --- a/commands/game/8ball.js +++ b/commands/game/8ball.js @@ -1,6 +1,7 @@ module.exports = { name: '8ball', description: 'Posez une question à la boule magique 8', + category: 'game', execute(message, args) { if (!args[0]) { return message.reply("Veuillez poser une question."); diff --git a/commands/game/catsay.js b/commands/game/catsay.js index 5c7fd18..ef30821 100644 --- a/commands/game/catsay.js +++ b/commands/game/catsay.js @@ -1,6 +1,7 @@ module.exports = { name: 'catsay', description: 'Faire parler les chat', + category: 'game', async execute( message, args) { message.delete() diff --git a/commands/game/demineur.js b/commands/game/demineur.js index ad4590f..79a2524 100644 --- a/commands/game/demineur.js +++ b/commands/game/demineur.js @@ -3,6 +3,7 @@ const { Minesweeper } = require('discord-gamecord'); module.exports = { name: 'demineur', description: 'Jouer à un jeu démineur', + category: 'game', async execute(message, args) { const Game = new Minesweeper({ message: message, diff --git a/commands/game/fasttype.js b/commands/game/fasttype.js index 596531f..a3ed25d 100644 --- a/commands/game/fasttype.js +++ b/commands/game/fasttype.js @@ -29,6 +29,7 @@ const sentences = [ module.exports = { name: 'fasttype', description: 'Jouer à un jeu de vitesse de frappe', + category: 'game', async execute(message, args) { const randomSentence = sentences[Math.floor(Math.random() * sentences.length)]; diff --git a/commands/game/findemoji.js b/commands/game/findemoji.js index 6372ab5..d8b10a8 100644 --- a/commands/game/findemoji.js +++ b/commands/game/findemoji.js @@ -3,6 +3,7 @@ const { FindEmoji } = require('discord-gamecord'); module.exports = { name: 'findemoji', description: 'Jouer au jeu Trouver Emoji', + category: 'game', async execute(message, args) { const Game = new FindEmoji({ message: message, diff --git a/commands/game/flood.js b/commands/game/flood.js index 6e33948..bd5fd43 100644 --- a/commands/game/flood.js +++ b/commands/game/flood.js @@ -3,6 +3,7 @@ const { Flood } = require('discord-gamecord'); module.exports = { name: 'flood', description: 'Jouer au jeu Flood', + category: 'game', async execute(message, args) { const Game = new Flood({ message: message, diff --git a/commands/game/guessThePokemon.js b/commands/game/guessThePokemon.js index 84b9dad..359c1e4 100644 --- a/commands/game/guessThePokemon.js +++ b/commands/game/guessThePokemon.js @@ -3,6 +3,7 @@ const { GuessThePokemon } = require('discord-gamecord'); module.exports = { name: 'guesspokemon', description: 'Jouer au jeu trouver le pokemon', + category: 'game', async execute(message, args) { const Game = new GuessThePokemon({ message: message, diff --git a/commands/game/morpion.js b/commands/game/morpion.js index b86d5da..33cf814 100644 --- a/commands/game/morpion.js +++ b/commands/game/morpion.js @@ -3,6 +3,7 @@ const { TicTacToe } = require('discord-gamecord'); module.exports = { name: 'morpion', description: 'Jouer à morpion', + category: 'game', async execute(message, args) { if (!message.mentions.members.first()) return message.reply("Veuillez mentionner un adversaire"); diff --git a/commands/game/pendu.js b/commands/game/pendu.js index e30d66c..289463f 100644 --- a/commands/game/pendu.js +++ b/commands/game/pendu.js @@ -28,6 +28,7 @@ const words = [ module.exports = { name: 'pendu', description: 'Jouer à pendu', + category: 'game', async execute(message, args) { const game = new Hangman({ message: message, diff --git a/commands/game/pfc.js b/commands/game/pfc.js index c737f5e..b88131e 100644 --- a/commands/game/pfc.js +++ b/commands/game/pfc.js @@ -3,6 +3,7 @@ const choices = ["pierre", "papier", "ciseaux"]; module.exports = { name: 'pfc', description: 'Jouer à pierre-papier-ciseaux', + category: 'game', async execute(message, args) { const userChoice = args[0]; const botChoice = choices[Math.floor(Math.random() * choices.length)]; diff --git a/commands/game/puissance4.js b/commands/game/puissance4.js index ff90521..7288beb 100644 --- a/commands/game/puissance4.js +++ b/commands/game/puissance4.js @@ -4,6 +4,7 @@ module.exports = { name: 'puissance4', usage: 'puissance4', description: 'Lancer une partis de puissance4', + category: 'game', async execute(message) { if (!message.mentions || !message.mentions.members.first()) diff --git a/commands/game/slot.js b/commands/game/slot.js index ee01b9d..d614710 100644 --- a/commands/game/slot.js +++ b/commands/game/slot.js @@ -3,6 +3,7 @@ const { Slots } = require('discord-gamecord'); module.exports = { name: 'slot', description: 'Jouer au jeu Slot', + category: 'game', async execute(message, args) { const Game = new Slots({ message: message, diff --git a/commands/game/snake.js b/commands/game/snake.js index 4c8c3bc..f955810 100644 --- a/commands/game/snake.js +++ b/commands/game/snake.js @@ -4,6 +4,7 @@ module.exports = { name: 'snake', usage: 'snake', description: 'Lancer une partis de snake', + category: 'game', async execute(message, args) { new Snake({ diff --git a/commands/game/wordle.js b/commands/game/wordle.js index e6eac53..3b2229d 100644 --- a/commands/game/wordle.js +++ b/commands/game/wordle.js @@ -50,6 +50,7 @@ const shortWords = words.filter(word => word.length === 5); module.exports = { name: 'wordle', description: 'Jouer à Wordle', + category: 'game', async execute(message, args) { const Game = new Wordle({ message: message, diff --git a/commands/gestion/create.js b/commands/gestion/create.js index 739a2ee..4a044db 100644 --- a/commands/gestion/create.js +++ b/commands/gestion/create.js @@ -3,6 +3,7 @@ const axios = require('axios'); module.exports = { name: 'create', description: 'Crée un emoji', + category: 'gestion', async execute(message, args, client) { if (!args.length) { return message.channel.send({ content: "Veuillez spécifier un émoji." }); diff --git a/commands/gestion/dm.js b/commands/gestion/dm.js index 51cc2d3..85131ad 100644 --- a/commands/gestion/dm.js +++ b/commands/gestion/dm.js @@ -1,6 +1,7 @@ module.exports = { name: 'dm', description: 'Envoie un message privé à un utilisateur', + category: 'gestion', async execute(message, args) { // Vérifie si un utilisateur a été mentionné const user = message.mentions.users.first(); diff --git a/commands/gestion/embed.js b/commands/gestion/embed.js index 1752557..2e3e98d 100644 --- a/commands/gestion/embed.js +++ b/commands/gestion/embed.js @@ -4,6 +4,7 @@ const { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require('dis module.exports = { name: 'embed', description: 'Crée un embed customisable', + category: 'gestion', async execute(message, args, client) { const embed = new EmbedBuilder(); diff --git a/commands/gestion/massiverole.js b/commands/gestion/massiverole.js index 806d8d2..804da55 100644 --- a/commands/gestion/massiverole.js +++ b/commands/gestion/massiverole.js @@ -3,6 +3,7 @@ const { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require('dis module.exports = { name: 'massiverole', description: 'Donne un rôle à tous les membres du serveur', + category: 'gestion', async execute(message, args) { // Vérifie si un rôle a été mentionné const role = message.mentions.roles.first(); diff --git a/commands/gestion/renew.js b/commands/gestion/renew.js index 9b33758..c49a91c 100644 --- a/commands/gestion/renew.js +++ b/commands/gestion/renew.js @@ -2,6 +2,7 @@ const { PermissionsBitField} = require("discord.js") module.exports = { name: 'renew', description: 'Renew un salon', + category: 'gestion', async execute(message, args, client) { const guild = message.guild; const channel = message.mentions.channels.first() || message.channel; diff --git a/commands/gestion/unmassiverole.js b/commands/gestion/unmassiverole.js index e5f127b..fbad5e2 100644 --- a/commands/gestion/unmassiverole.js +++ b/commands/gestion/unmassiverole.js @@ -3,6 +3,7 @@ const { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require('dis module.exports = { name: 'unmassiverole', description: 'Retire un rôle à tous les membres du serveur', + category: 'gestion', async execute(message, args, client) { // Vérifie si un rôle a été mentionné const role = message.mentions.roles.first(); diff --git a/commands/help.js b/commands/help.js index bbc41e3..fadbed4 100644 --- a/commands/help.js +++ b/commands/help.js @@ -2,47 +2,79 @@ const { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder } = require("di module.exports = { name: 'help', description: 'Affiche la liste des commandes', + category: 'other', + emote: '📚', + utilisation: '', async execute(message, args, client) { - const embed = new EmbedBuilder() - .setColor('#0099ff') - .setTitle('Aide') - .setDescription('Sélectionnez une catégorie pour voir les commandes correspondantes.'); + const categories = { + antiraid: [], + botcontrol: [], + game: [], + gestion: [], + utils: [], + other: [], + // Ajoutez plus de catégories si nécessaire + }; - const embedCat1 = new EmbedBuilder() + // Organisez les commandes par catégorie + for (const command of client.commands.values()) { + if (command.category) { + categories[command.category].push({ name: command.name, description: command.description, emote: command.emote, utilisation: command.utilisation}); + } + } + + let description = 'Sélectionnez une catégorie parmi les options ci-dessous pour obtenir de l\'aide sur les commandes correspondantes.\n\n'; + + for (const [category, commands] of Object.entries(categories)) { + description += `**Catégorie ${category}**\n`; + description += commands.length > 0 ? '> ' + commands.map(command => `\`${command.name}\``).join(', ') : '> Aucune commande dans cette catégorie'; + description += '\n\n'; + } + + const embeds = { + home: new EmbedBuilder() + .setColor('#0099ff') + .setTitle('📚 Information') + .setDescription(description) + .setThumbnail(message.guild.iconURL()) + }; + + // Créez un embed pour chaque catégorie + for (const [category, commands] of Object.entries(categories)) { + let description; + if (commands.length > 0) { + description = commands.map(command => `${command.emote ? ` ${command.emote}` : '🔧'} \`+${command.name}${command.utilisation ? ` ${command.utilisation}` : ''}\`\n ${command.description}`).join('\n'); + } else { + description = 'Aucune commande dans cette catégorie.'; + } + + embeds[category] = new EmbedBuilder() .setColor('#0099ff') - .setTitle('Catégorie 1') - .setDescription('Commandes de la catégorie 1'); - - const embedCat2 = new EmbedBuilder() - .setColor('#0099ff') - .setTitle('Catégorie 2') - .setDescription('Commandes de la catégorie 2'); + .setTitle(`Catégorie ${category}`) + .setDescription(description); +} const menu = new StringSelectMenuBuilder() .setCustomId('help_menu') .setPlaceholder('Sélectionnez une catégorie') .addOptions([ { label: 'Accueil', value: 'home' }, - { label: 'Catégorie 1', value: 'cat1' }, - { label: 'Catégorie 2', value: 'cat2' }, - // Ajoutez plus d'options pour chaque catégorie de commandes + ...Object.keys(categories).map(category => ({ label: `Catégorie ${category}`, value: category })), ]); const row = new ActionRowBuilder() .addComponents(menu); - const sentMessage = await message.reply({ embeds: [embed], components: [row] }); + const sentMessage = await message.reply({ embeds: [embeds.home], components: [row] }); const filter = i => i.customId === 'help_menu' && i.user.id === message.author.id; - const collector = sentMessage.createMessageComponentCollector({ filter, time: 15000 }) + const collector = sentMessage.createMessageComponentCollector({ filter, time: 15000 }); collector.on('collect', async (interaction) => { - if (interaction.values[0] === 'home') { - await interaction.update({ embeds: [embed] }); - } else if (interaction.values[0] === 'cat1') { - await interaction.update({ embeds: [embedCat1] }); - } else if (interaction.values[0] === 'cat2') { - await interaction.update({ embeds: [embedCat2] }); - } + await interaction.update({ embeds: [embeds[interaction.values[0]]] }); }); + + collector.on('end', () => { + sentMessage.edit({ components: [] }); + }); }, }; \ No newline at end of file diff --git a/commands/utils/avatar.js b/commands/utils/avatar.js index 3af08bc..e8098ed 100644 --- a/commands/utils/avatar.js +++ b/commands/utils/avatar.js @@ -2,6 +2,7 @@ const { EmbedBuilder, ButtonStyle, ButtonBuilder, ActionRowBuilder } = require( module.exports = { name: 'avatar', description: 'Affiche l\'avatar d\'un utilisateur', + category: 'utils', async execute(message, args, client) { let user; if (message.mentions.users.size > 0) { diff --git a/commands/utils/ping.js b/commands/utils/ping.js index ba681be..11ffb29 100644 --- a/commands/utils/ping.js +++ b/commands/utils/ping.js @@ -3,6 +3,7 @@ const { ButtonStyle, ButtonBuilder, ActionRowBuilder } = require('discord.js'); module.exports = { name: 'ping', description: 'Command to check the latency of the bot.', + category: 'utils', async execute(message, args, client) { const ping = new ButtonBuilder() .setCustomId('confirm') diff --git a/commands/utils/serverinfo.js b/commands/utils/serverinfo.js index 731608b..b7f22e6 100644 --- a/commands/utils/serverinfo.js +++ b/commands/utils/serverinfo.js @@ -2,6 +2,7 @@ const { EmbedBuilder } = require("discord.js") module.exports = { name: 'serverinfo', description: 'Affiche les informations sur le serveur', + category: 'utils', async execute(message, args, client) { const embed = new EmbedBuilder() .setAuthor({name: `${message.guild.name}`, iconURL: message.guild.iconURL({dynamic : true})}) diff --git a/commands/utils/snipe.js b/commands/utils/snipe.js index 1585653..f3c1fb2 100644 --- a/commands/utils/snipe.js +++ b/commands/utils/snipe.js @@ -2,6 +2,7 @@ const { EmbedBuilder, User } = require("discord.js") module.exports = { name: 'snipe', description: 'Affiche le dernier message supprimé dans le salon', + category: 'utils', async execute(message, args, client) { // Récupère le dernier message supprimé du salon let snipe = client.snipes.get(message.channel.id); diff --git a/commands/utils/userinfo.js b/commands/utils/userinfo.js index d3672c1..1fbc1b4 100644 --- a/commands/utils/userinfo.js +++ b/commands/utils/userinfo.js @@ -2,6 +2,7 @@ const { EmbedBuilder } = require("discord.js") module.exports = { name: 'userinfo', description: 'Affiche les informations sur un utilisateur', + category: 'utils', async execute(message, args, client) { let user; if (args.length > 0) {