Compare commits

...

2 commits

Author SHA1 Message Date
adad5db364
add info about one command 2022-07-25 00:14:29 +02:00
2385520980
update translation 2022-07-25 00:14:15 +02:00
2 changed files with 27 additions and 12 deletions

View file

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