feat: help command #36

Merged
Anri merged 23 commits from help into main 2022-07-25 00:54:19 +02:00
2 changed files with 38 additions and 1 deletions
Showing only changes of commit dc8c0ab570 - Show all commits

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."
}