Compare commits

..

No commits in common. "adad5db3645b45ea2b1a4468f19f6ee0e1d0811a" and "2f9053bcc914a779d4d96362d4f0c16d28229911" have entirely different histories.

2 changed files with 12 additions and 27 deletions

View file

@ -17,7 +17,6 @@ export default {
getLocalizations(client, `c_${filename}_name`, true)) getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations( .setDescriptionLocalizations(
getLocalizations(client, `c_${filename}_desc`)) getLocalizations(client, `c_${filename}_desc`))
.addStringOption(option => option .addStringOption(option => option
.setName(client.locales.get(client.config.default_lang) .setName(client.locales.get(client.config.default_lang)
?.get(`c_${filename}_opt1_name`) ?? '') ?.get(`c_${filename}_opt1_name`) ?? '')
@ -37,8 +36,11 @@ export default {
.get(client.config.default_lang) .get(client.config.default_lang)
?.get(`c_${getFilename(__filename)}_opt1_name`) ?? ''); ?.get(`c_${getFilename(__filename)}_opt1_name`) ?? '');
// If a command isn't specified // If a command is specified
if (!desired_command) { if (desired_command) {
// Check if command exists
interaction.reply({ content: 'WIP', ephemeral: true });
} else {
const fields: { const fields: {
name: string; name: string;
value: string; value: string;
@ -46,21 +48,21 @@ export default {
client.commands.categories.forEach((commands_name, category) => { client.commands.categories.forEach((commands_name, category) => {
const commands_description = commands_name.reduce( const commands_description = commands_name.reduce(
(data, command_name) => { (compteur, command_name) => {
const command = client.commands.list.get(command_name); const command = client.commands.list.get(command_name);
data += `- \`/${command?.data.name}\` : `; let res = `${compteur}- \`${command_name}\` : `;
if (command?.data) { if (command?.data) {
const description = const description =
command.data.description_localizations command.data.description_localizations
?.[interaction.locale as Locale] ?.[interaction.locale as Locale]
?? command.data.description; ?? command.data.description;
data += `${description}\n`; res += `${description}\n`;
} else { } else {
data += `${loc.get('c_help3')}\n`; res += `${loc.get('c_help3')}\n`;
} }
return data; return res;
}, ''); }, '');
fields.push({ fields.push({
@ -69,7 +71,7 @@ export default {
}); });
}); });
return interaction.reply({ embeds: [ interaction.reply({ embeds: [
new MessageEmbed() new MessageEmbed()
.setColor('BLURPLE') .setColor('BLURPLE')
.setTitle(loc.get('c_help1')) .setTitle(loc.get('c_help1'))
@ -77,21 +79,5 @@ export default {
.addFields(fields), .addFields(fields),
] }); ] });
} }
// If a command is specified
const command = client.commands.list.get(desired_command);
if (!command) {
return interaction.reply({
content: `${loc.get('c_help4')} \`${desired_command}\``,
ephemeral: true,
});
}
return interaction.reply({ embeds: [
new MessageEmbed()
.setColor('BLURPLE')
.setTitle('`/' + command.data.name + '`')
.setDescription(command.data.description),
] });
}, },
}; };

View file

@ -12,6 +12,5 @@
"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": "Pas d'information.", "c_help3": "Pas d'information."
"c_help4": "Impossible de trouver :"
} }