Compare commits

..

No commits in common. "787a4a2abdb5cbe25682a0405b27eaa8849b28f7" and "64f61e35e86194a917150ae08bafa6d041475210" have entirely different histories.

3 changed files with 30 additions and 15 deletions

View file

@ -47,13 +47,33 @@ export default {
// Load all the command per categories // Load all the command per categories
client.commands.categories.forEach((commands_name, category) => { client.commands.categories.forEach((commands_name, category) => {
const commands = commands_name.reduce((data, command_name) => { const commands_description = commands_name.reduce(
return data + `\`/${command_name}\`, `; (data, command_name) => {
}, ''); const command = client.commands.list.get(command_name);
data += `- \`/${command_name}\` : `;
// If the command is correct, usually it is
if (command?.data) {
// Loads the description
// according to the user's locals
const description =
command.data.description_localizations
?.[interaction.locale as Locale]
?? command.data.description;
data += `${description}\n`;
} else {
// Error message
data += `${loc.get('c_help3')}\n`;
}
// TODO: Check that `data` does not exceed
// the maximum character limit
return data;
}, '');
fields.push({ fields.push({
name: category.capitalize() + ` (${commands_name.length})`, name: category.capitalize(),
value: commands.slice(0, -2), value: commands_description,
}); });
}); });
@ -72,7 +92,7 @@ export default {
if (!command) { if (!command) {
// Command don't exist // Command don't exist
return interaction.reply({ return interaction.reply({
content: `${loc.get('c_help3')} \`${desired_command}\``, content: `${loc.get('c_help4')} \`${desired_command}\``,
ephemeral: true, ephemeral: true,
}); });
} }
@ -82,13 +102,7 @@ export default {
new MessageEmbed() new MessageEmbed()
.setColor('BLURPLE') .setColor('BLURPLE')
.setTitle('`/' + command.data.name + '`') .setTitle('`/' + command.data.name + '`')
.setDescription( .setDescription(command.data.description),
// Loads the description
// according to the user's locals
command.data.description_localizations
?.[interaction.locale as Locale]
?? command.data.description
),
] }); ] });
}, },
}; };

View file

@ -12,5 +12,5 @@
"c_help_opt1_desc": "Command wanted in depth.", "c_help_opt1_desc": "Command wanted in depth.",
"c_help1": "List of categories and associated commands", "c_help1": "List of categories and associated commands",
"c_help2": "`/help <command>` to get more information about a command.", "c_help2": "`/help <command>` to get more information about a command.",
"c_help3": "Can't find :" "c_help3": "No information available."
} }

View file

@ -12,5 +12,6 @@
"c_help_opt1_desc": "Commande voulu en détail.", "c_help_opt1_desc": "Commande voulu en détail.",
"c_help1": "Liste des catégories et des commandes associées", "c_help1": "Liste des catégories et des commandes associées",
"c_help2": "`/help <commande>` pour obtenir plus d'informations sur une commande.", "c_help2": "`/help <commande>` pour obtenir plus d'informations sur une commande.",
"c_help3": "Impossible de trouver :" "c_help3": "Pas d'information.",
"c_help4": "Impossible de trouver :"
} }