show categories, commands name and desc

This commit is contained in:
Mylloon 2022-07-24 15:46:01 +02:00
parent 33dd6cfc17
commit a857898300
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -9,23 +9,41 @@ export default {
return new SlashCommandBuilder()
.setName(filename.toLowerCase())
.setDescription(client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? '')
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`))
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`, true))
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
},
interaction: async (interaction: CommandInteraction, client: Client) => {
const loc = getLocale(client, interaction.locale);
const command_name = interaction.options.getString('command');
const desired_command = interaction.options.getString('command');
// If a command is specified
if (command_name) {
if (desired_command) {
// Check if command exists
interaction.reply({ content: 'WIP', ephemeral: true });
} else {
const fields = [];
fields.push({
name: 'WIP',
value: 'WIP',
const fields: {
name: string;
value: string;
}[] = [];
client.commands.categories.forEach((commands_name, category) => {
const commands_description = commands_name.reduce((compteur, command_name) => {
const command = client.commands.list.get(command_name);
let res = `${compteur}- \`${command_name}\` : `;
if (command?.data) {
res += `${command.data(client).description}.\n`;
} else {
res += loc.get('c_help3');
}
return res;
}, '');
fields.push({
name: category,
value: commands_description,
});
});
interaction.reply({ embeds: [