From bd70f2bedc00a8da4a4cd2c85b2ff01d43edc2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Thu, 26 Aug 2021 17:02:11 +0300 Subject: [PATCH] Removed comments in help.js --- src/client/commands/help.js | 55 ++++++++++++------------------------- 1 file changed, 18 insertions(+), 37 deletions(-) diff --git a/src/client/commands/help.js b/src/client/commands/help.js index 2ae9b85..21ddf29 100644 --- a/src/client/commands/help.js +++ b/src/client/commands/help.js @@ -13,44 +13,25 @@ module.exports = { execute(interaction, client, Discord, command) { let message = {}; - /*if (args[1]) { - if (!client.commands.has(args[1]) || (client.commands.has(args[1]) && client.commands.get(args[1]).omitFromHelp === true)) return interaction.reply('That command does not exist'); - const command = client.commands.get(args[1]); + const categories = []; + for (let i = 0; i < client.commands.size; i++) { + if (!categories.includes([...client.commands.values()][i].category)) categories.push([...client.commands.values()][i].category); + } + let commands = ''; + for (let i = 0; i < categories.length; i++) { + commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp).map(x => `\`${x.name}\``).join(', ')}\n`; + } - message.helpCommandTitle = client.messages.helpCommandTitle.replace("%client.config.prefix%", client.config.prefix); - message.helpCommandTitle = message.helpCommandTitle.replace("%command.name%", command.name); - message.helpCommandTitle = message.helpCommandTitle.replace("%command.usage%", command.usage); - message.helpCommandDescription = client.messages.helpCommandDescription.replace("%command.description%", command.description); - message.helpCommandDescription = message.helpCommandDescription.replace("%command.alias%", command.alias); + message.helpTitle = client.messages.helpTitle.replace("%client.user.username%", client.user.username); + message.helpDescription = client.messages.helpDescription.replace("%commands%", commands); + message.helpDescription = message.helpDescription.replace("%client.config.prefix%", client.config.prefix); - const embed = new Discord.MessageEmbed() - .setTitle(message.helpCommandTitle) - .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, '')) - .setColor(client.config.embedColor) - .setDescription(message.helpCommandDescription) - .setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')); - interaction.reply({ embeds: [embed] }); - } else {*/ - const categories = []; - for (let i = 0; i < client.commands.size; i++) { - if (!categories.includes([...client.commands.values()][i].category)) categories.push([...client.commands.values()][i].category); - } - let commands = ''; - for (let i = 0; i < categories.length; i++) { - commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp).map(x => `\`${x.name}\``).join(', ')}\n`; - } - - message.helpTitle = client.messages.helpTitle.replace("%client.user.username%", client.user.username); - message.helpDescription = client.messages.helpDescription.replace("%commands%", commands); - message.helpDescription = message.helpDescription.replace("%client.config.prefix%", client.config.prefix); - - const embed = new Discord.MessageEmbed() - .setTitle(message.helpTitle) - .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, '')) - .setColor(client.config.embedColor) - .setDescription(message.helpDescription) - .setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')); - interaction.reply({ embeds: [embed] }); - /*}*/ + const embed = new Discord.MessageEmbed() + .setTitle(message.helpTitle) + .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, '')) + .setColor(client.config.embedColor) + .setDescription(message.helpDescription) + .setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')); + interaction.reply({ embeds: [embed] }); } };