mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-21 13:55:06 +02:00
add base help command
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
const { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder } = require("discord.js")
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
description: 'Affiche la liste des commandes',
|
||||
async execute(message, args, client) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor('#0099ff')
|
||||
.setTitle('Aide')
|
||||
.setDescription('Sélectionnez une catégorie pour voir les commandes correspondantes.');
|
||||
|
||||
const embedCat1 = new EmbedBuilder()
|
||||
.setColor('#0099ff')
|
||||
.setTitle('Catégorie 1')
|
||||
.setDescription('Commandes de la catégorie 1');
|
||||
|
||||
const embedCat2 = new EmbedBuilder()
|
||||
.setColor('#0099ff')
|
||||
.setTitle('Catégorie 2')
|
||||
.setDescription('Commandes de la catégorie 2');
|
||||
|
||||
const menu = new StringSelectMenuBuilder()
|
||||
.setCustomId('help_menu')
|
||||
.setPlaceholder('Sélectionnez une catégorie')
|
||||
.addOptions([
|
||||
{ label: 'Accueil', value: 'home' },
|
||||
{ label: 'Catégorie 1', value: 'cat1' },
|
||||
{ label: 'Catégorie 2', value: 'cat2' },
|
||||
// Ajoutez plus d'options pour chaque catégorie de commandes
|
||||
]);
|
||||
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(menu);
|
||||
|
||||
const sentMessage = await message.reply({ embeds: [embed], components: [row] });
|
||||
|
||||
const filter = i => i.customId === 'help_menu' && i.user.id === message.author.id;
|
||||
const collector = sentMessage.createMessageComponentCollector({ filter, time: 15000 })
|
||||
collector.on('collect', async (interaction) => {
|
||||
if (interaction.values[0] === 'home') {
|
||||
await interaction.update({ embeds: [embed] });
|
||||
} else if (interaction.values[0] === 'cat1') {
|
||||
await interaction.update({ embeds: [embedCat1] });
|
||||
} else if (interaction.values[0] === 'cat2') {
|
||||
await interaction.update({ embeds: [embedCat2] });
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user