show categories, commands name and desc
This commit is contained in:
parent
33dd6cfc17
commit
a857898300
1 changed files with 25 additions and 7 deletions
|
@ -9,23 +9,41 @@ export default {
|
||||||
return new SlashCommandBuilder()
|
return new SlashCommandBuilder()
|
||||||
.setName(filename.toLowerCase())
|
.setName(filename.toLowerCase())
|
||||||
.setDescription(client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? '')
|
.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`));
|
.setDescriptionLocalizations(getLocalizations(client, `c_${filename}_desc`));
|
||||||
},
|
},
|
||||||
|
|
||||||
interaction: async (interaction: CommandInteraction, client: Client) => {
|
interaction: async (interaction: CommandInteraction, client: Client) => {
|
||||||
const loc = getLocale(client, interaction.locale);
|
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 a command is specified
|
||||||
if (command_name) {
|
if (desired_command) {
|
||||||
// Check if command exists
|
// Check if command exists
|
||||||
interaction.reply({ content: 'WIP', ephemeral: true });
|
interaction.reply({ content: 'WIP', ephemeral: true });
|
||||||
} else {
|
} else {
|
||||||
const fields = [];
|
const fields: {
|
||||||
fields.push({
|
name: string;
|
||||||
name: 'WIP',
|
value: string;
|
||||||
value: 'WIP',
|
}[] = [];
|
||||||
|
|
||||||
|
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: [
|
interaction.reply({ embeds: [
|
||||||
|
|
Loading…
Reference in a new issue