module.exports = { name: `help`, description: `Affiche toutes les commandes du bot.`, usage: `[commande] ou rien`, aliases: [`h`], args: false, exclude: true, guildOnly: false, category: `Information`, async execute(client, message, args, discord, functions) { const application = await client.fetchApplication(); if (!args[0]) { const embed = new discord.MessageEmbed() .setColor(`#1DD460`) .setAuthor(message.author.username, message.author.displayAvatarURL({ dynamic: true }) || "") .setTitle(`Liste de toutes les commandes`) .setDescription(`Tu peut aussi envoyer \`${process.env.PREFIX}help [commande]\` pour avoir les informations d'une commande !`) .setTimestamp() .setFooter(client.user.username, client.user.displayAvatarURL({ dynamic: true })); let validCommands = message.author.id == application.owner.id ? client.commands : client.commands.filter(c => !c.exclude === true); const categories = validCommands.map(c => c.category).filter((v, i, a) => a.indexOf(v) === i); categories.sort((a, b) => `${a}`.localeCompare(`${b}`)).forEach(category => { const commands = validCommands.filter(c => c.category === category).sort((a, b) => a.name.localeCompare(b.name)).map(c => `\`${functions.ENVFORMATVALUE(process.env.PREFIX)}${c.name}\``).join('**, **'); const length = validCommands.filter(c => c.category === category).size; embed.addField(`❯ ${category || `Catégorie non indiqué`}: [**${length}**]`, `${commands}`, false); }); if (!embed.fields.length) { embed.setTitle(`Aucune commande n'est enregistré !`); embed.setDescription(``); }; message.channel.send(embed); } else if (args[0]) { const command = client.commands.get(client.aliases.get(args[0].toLocaleLowerCase()) || args[0].toLocaleLowerCase()); if (command.exclude == true && message.author.id !== application.owner.id) return; const embed = new discord.MessageEmbed() .setColor(`#1DD460`) .setAuthor(message.author.username, message.author.displayAvatarURL({ dynamic: true }) || "") .setTitle(`Informations concernant une commande`) .addField(`• __Nom__`, `\`${functions.ENVFORMATVALUE(process.env.PREFIX)}${command.name}\``, true) if (command.aliases) embed.addField(`• __Aliases__`, `\`${functions.ENVFORMATVALUE(process.env.PREFIX)}${command.aliases.join(`\`**,** \`${functions.ENVFORMATVALUE(process.env.PREFIX)}`)}\``, true); if (command.description) embed.addField(`• __Description__`, `\`${command.description}\``); if (command.usage) embed.addField(`• __Utilisation__`, `\`${command.usage}\``); embed.addField(`• __Catégorie__`, `\`${command.category || `Catégorie non indiqué`}\``, true) embed.addField(`• __Arguments nécessaire__`, `\`${command.args ? `Oui` : `Non`}\``, true) embed.addField(`• __Serveur uniquement__`, `\`${command.guildOnly ? `Oui` : `Non`}\``, true) embed.setTimestamp() embed.setFooter(client.user.username, client.user.displayAvatarURL({ dynamic: true })); message.channel.send(embed); }; } };