mirror of
https://github.com/arthur-pbty/gestion-perso.git
synced 2026-06-03 23:36:35 +02:00
89 lines
2.9 KiB
JavaScript
89 lines
2.9 KiB
JavaScript
const { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder } = require("discord.js")
|
|
/*
|
|
module.exports = {
|
|
aliases: ['h', 'aide'],
|
|
description: 'Affiche la liste des commandes',
|
|
emote: '📚',
|
|
utilisation: '[commande]',
|
|
|
|
async execute(message, args, client) {
|
|
console.log("Liste des commandes :");
|
|
let commands = [];
|
|
for (const command of client.commands.values()) {
|
|
const existingCommand = commands.find(cmd => cmd.name === command.name);
|
|
if (!existingCommand) {
|
|
commands.push(command);
|
|
}
|
|
}
|
|
console.log(commands);
|
|
},
|
|
};
|
|
*/
|
|
|
|
|
|
|
|
module.exports = {
|
|
aliases: ['h', 'aide'],
|
|
description: 'Affiche la liste des commandes',
|
|
emote: '📚',
|
|
utilisation: '[commande]',
|
|
|
|
async execute(message, args, client) {
|
|
const prefix = '+'
|
|
if (args[0]) {
|
|
const command = client.commands.get(args[0]);
|
|
if (!command) {
|
|
return message.reply(`Je n'ai pas trouvé de commande nommée "${args[0]}".`);
|
|
}
|
|
|
|
const commandPerm = 'None'
|
|
|
|
const embed_command = new EmbedBuilder()
|
|
.setColor('#0099ff')
|
|
.setTitle(`Aide pour la commande ${command.emote ? ` ${command.emote}` : '🔧'} ${command.name}`)
|
|
.setDescription(command.description)
|
|
.addFields(
|
|
{ name: 'Utilisation', value: `\`${prefix}${command.utilisation ? `${command.utilisation}` : ''}\``, inline: true },
|
|
{ name: 'Catégorie', value: command.category || 'Non spécifiée', inline: true },
|
|
{ name: 'Alias', value: command.aliases ? command.aliases.map(alias => `\`${alias}\``).join(', ') : 'Aucun', inline: true },
|
|
{ name: 'Permissions', value: `Perm level: ${commandPerm}` || 'Indéfini', inline: true },
|
|
)
|
|
.setTimestamp()
|
|
.setFooter({text: `${client.user.tag} © 2024`, iconURL: client.user.displayAvatarURL({dynamic: true})})
|
|
|
|
return message.reply({ embeds: [embed_command] });
|
|
|
|
} else {
|
|
|
|
let commands = [];
|
|
for (const command of client.commands.values()) {
|
|
const existingCommand = commands.find(cmd => cmd.name === command.name);
|
|
if (!existingCommand) {
|
|
commands.push(command);
|
|
}
|
|
}
|
|
|
|
let categories = {};
|
|
commands.forEach((command) => {
|
|
if (!categories[command.category]) {
|
|
categories[command.category] = [];
|
|
}
|
|
categories[command.category].push(command);
|
|
});
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setTitle('Liste des commandes')
|
|
.setDescription('Sélectionnez une catégorie parmi les options ci-dessous pour obtenir de l\'aide sur les commandes correspondantes.')
|
|
.setColor('#0099ff');
|
|
|
|
for (const [category, commands] of Object.entries(categories)) {
|
|
embed.addFields({
|
|
name: `Catégorie ${category}`,
|
|
value: commands.map(command => `\`${command.name}\` - ${command.description}`).join('\n')
|
|
});
|
|
}
|
|
|
|
message.channel.send({ embeds: [embed] });
|
|
}
|
|
},
|
|
}; |