add comments
This commit is contained in:
parent
adad5db364
commit
64f61e35e8
1 changed files with 12 additions and 1 deletions
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue