finish soutien module and reworked help commande

This commit is contained in:
VALOU3336
2024-04-24 12:01:56 +02:00
parent a9c8732f1f
commit eead6b1c4b
3 changed files with 326 additions and 177 deletions
+43 -38
View File
@@ -186,18 +186,6 @@ module.exports = {
return message.reply({ embeds: [embed_command] });
}
const categories = {
antiraid: [],
botcontrol: [],
moderation: [],
buyer: [],
game: [],
gestion: [],
utils: [],
invitation: [],
other: [],
};
const categoryEmojis = {
antiraid: '🛡️',
botcontrol: '🛠️',
@@ -209,39 +197,56 @@ module.exports = {
invitation: '📩',
other: '❓',
};
let liste = [];
let categories = {
antiraid: [],
botcontrol: [],
moderation: [],
buyer: [],
game: [],
gestion: [],
utils: [],
invitation: [],
other: [],
};
let liste = [];
for (const command of client.commands.values()) {
for (const command of client.commands.values()) {
const existingCommand = liste.find(cmd => cmd.name === command.name);
if (!existingCommand) {
liste.push(command);
liste.push(command);
}
}
for (const command of liste) {
}
for (const command of liste) {
if (command.category && categories[command.category]) {
categories[command.category].push({ name: command.name, description: command.description, emote: command.emote, utilisation: command.utilisation});
categories[command.category].push(command);
} else {
categories['other'].push({ name: command.name, description: command.description, emote: command.emote, utilisation: command.utilisation});
categories['other'].push(command);
}
}
let totalCommands = liste.length
let description = `Sélectionnez une catégorie parmi les options ci-dessous pour obtenir de l'aide sur les commandes correspondantes.\n Il y a ${totalCommands} commandes disponibles\n\n`;
for (const [category, commands] of Object.entries(categories)) {
description += `**Catégorie ${category}** (${commands.length})\n`;
description += commands.length > 0 ? '> ' + commands.map(command => `\`${command.name}\``).join(', ') : '> Aucune commande dans cette catégorie';
description += '\n\n';
}
const embeds = {
}
let totalCommands = liste.length;
let commandCounts = {};
for (const [category, commands] of Object.entries(categories)) {
commandCounts[category] = commands.length;
}
const embeds = {
home: new EmbedBuilder()
.setColor('#0099ff')
.setTitle('📚 Information')
.setDescription(description)
.setThumbnail(message.guild.iconURL())
.setTimestamp()
.setFooter({text: `${client.user.tag} © 2024`, iconURL: client.user.displayAvatarURL({dynamic: true})})
};
.setColor('#0099ff')
.setTitle('📚 Information')
.setDescription(`Sélectionnez une catégorie parmi les options ci-dessous pour obtenir de l'aide sur les commandes correspondantes.Il y a ${totalCommands} commandes disponibles`)
.setThumbnail(message.guild.iconURL())
.setTimestamp()
.setFooter({text: `By Valou336 and tuturp33`, iconURL: client.user.displayAvatarURL({dynamic: true})})
};
let categoriesString = '';
for (const [category, emoji] of Object.entries(categoryEmojis)) {
categoriesString += `${emoji} ${category.charAt(0).toUpperCase() + category.slice(1)}: ${commandCounts[category]} \n`;
}
embeds.home.addFields({name: ' ', value: `\`\`\`${categoriesString}\`\`\``});
for (const [category, commands] of Object.entries(categories)) {
let description;
@@ -263,7 +268,7 @@ module.exports = {
.setCustomId('help_menu')
.setPlaceholder('Sélectionnez une catégorie')
.addOptions([
{ label: 'Accueil', value: 'home' },
{ label: '🏠 Accueil', value: 'home' },
...Object.keys(categories).map(category => ({ label: `${categoryEmojis[category]} ${category}`, value: category })),
]);