diff --git a/src/commands/misc/help.ts b/src/commands/misc/help.ts index 3540301..47af03f 100644 --- a/src/commands/misc/help.ts +++ b/src/commands/misc/help.ts @@ -9,23 +9,41 @@ export default { return new SlashCommandBuilder() .setName(filename.toLowerCase()) .setDescription(client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? '') - .setNameLocalizations(getLocalizations(client, `c_${filename}_name`)) + .setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true)) .setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`)); }, interaction: async (interaction: CommandInteraction, client: Client) => { const loc = getLocale(client, interaction.locale); - const command_name = interaction.options.getString('command'); + const desired_command = interaction.options.getString('command'); // If a command is specified - if (command_name) { + if (desired_command) { // Check if command exists interaction.reply({ content: 'WIP', ephemeral: true }); } else { - const fields = []; - fields.push({ - name: 'WIP', - value: 'WIP', + const fields: { + name: string; + value: string; + }[] = []; + + client.commands.categories.forEach((commands_name, category) => { + const commands_description = commands_name.reduce((compteur, command_name) => { + const command = client.commands.list.get(command_name); + let res = `${compteur}- \`${command_name}\` : `; + if (command?.data) { + res += `${command.data(client).description}.\n`; + } else { + res += loc.get('c_help3'); + } + + return res; + }, ''); + + fields.push({ + name: category, + value: commands_description, + }); }); interaction.reply({ embeds: [