const Discord = require("discord.js"); module.exports = { name: "help", category: "general", description: "displays all available commands.", run: async (client, message, args) => { // const commands = client.commands.map(command => `${command.name} - ${command.description}`).join("\n"); const Ccommands = Array.from(client.commands.values()); const requester = message.author; let categories = Object.keys(Ccommands.reduce((acc, command) => { if(!command.category) command.category === "Default" if (!acc[command.category]) { acc[command.category] = []; } acc[command.category].push(command); return acc; }, {})); const helpEmbed = new Discord.MessageEmbed() .setColor("#2f3136") .setTitle("Command List") // hi jade / dark red steve lacy is so good .setTimestamp() .setFooter({text: `Requested by ${requester.username}`, iconURL: requester.displayAvatarURL()}); categories.forEach(category => { let commands = Ccommands.filter(command => { return command.category === category }) let commands2 = ""; for(let i =0; i< commands.length; i++) { const command = commands[i]; commands2 += `${command.name} ${command.aliases ? `${command.aliases.join(", ")}` : ""} - ${command.description}\n` } console.log(commands2) helpEmbed.addField(category, commands2) }) message.reply({ embeds: [helpEmbed] }); }, };