feat: help command #36

Merged
Anri merged 23 commits from help into main 2022-07-25 00:54:19 +02:00
Showing only changes of commit a857898300 - Show all commits

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 = [];
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: 'WIP',
value: 'WIP',
name: category,
value: commands_description,
});
});
interaction.reply({ embeds: [