add comments

This commit is contained in:
Mylloon 2022-07-25 00:26:03 +02:00
parent adad5db364
commit 64f61e35e8
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -18,6 +18,7 @@ export default {
.setDescriptionLocalizations(
getLocalizations(client, `c_${filename}_desc`))
// Command option
.addStringOption(option => option
.setName(client.locales.get(client.config.default_lang)
?.get(`c_${filename}_opt1_name`) ?? '')
@ -44,12 +45,16 @@ export default {
value: string;
}[] = [];
// Load all the command per categories
client.commands.categories.forEach((commands_name, category) => {
const commands_description = commands_name.reduce(
(data, command_name) => {
const command = client.commands.list.get(command_name);
data += `- \`/${command?.data.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]
@ -57,9 +62,12 @@ export default {
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;
}, '');
@ -69,6 +77,7 @@ export default {
});
});
// Sends a list of commands sorted into categories
return interaction.reply({ embeds: [
new MessageEmbed()
.setColor('BLURPLE')
@ -81,12 +90,14 @@ export default {
// If a command is specified
const command = client.commands.list.get(desired_command);
if (!command) {
// Command don't exist
return interaction.reply({
content: `${loc.get('c_help4')} \`${desired_command}\``,
ephemeral: true,
});
}
// Send information about the command
return interaction.reply({ embeds: [
new MessageEmbed()
.setColor('BLURPLE')