WIP: help command

This commit is contained in:
Mylloon 2022-07-24 13:51:07 +02:00
parent 812c40bb88
commit dc8c0ab570
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 38 additions and 1 deletions

34
src/commands/misc/help.ts Normal file
View file

@ -0,0 +1,34 @@
import { SlashCommandBuilder } from '@discordjs/builders';
import { Client, CommandInteraction, MessageEmbed } from 'discord.js';
import { getLocale, getLocalizations } from '../../utils/locales';
import { getFilename } from '../../utils/misc';
export default {
data: (client: Client) => {
const filename = getFilename(__filename);
return new SlashCommandBuilder()
.setName(filename.toLowerCase())
.setDescription(client.locales.get(client.config.default_lang)?.get(`c_${filename}_desc`) ?? '?')
.setNameLocalizations(getLocalizations(client, `c_${filename}_name`))
.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');
// If a command is specified
if (command_name) {
// Check if command exists
interaction.reply({ content: 'WIP', ephemeral: true });
} else {
const embed = new MessageEmbed()
.setColor('BLURPLE')
.setTitle(loc.get('c_help1'))
.setDescription(loc.get('c_help2'))
.addField('WIP', 'WIP');
interaction.reply({ embeds: [embed] });
}
},
};

View file

@ -3,5 +3,8 @@
"c_ping_desc": "Pong!",
"c_ping1": "Latence totale",
"c_ping2": "Latence du Websocket"
"c_ping2": "Latence du Websocket",
"c_help1": "Liste des catégories et des commandes associées",
"c_help2": "`/help <commande>` pour obtenir plus d'informations sur une commande."
}