mirror of
https://github.com/arthur-pbty/gestion.git
synced 2026-06-13 23:58:16 +02:00
Update help with good configurationon commands
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
const { EmbedBuilder, ButtonStyle, ButtonBuilder, ActionRowBuilder } = require("discord.js")
|
||||
module.exports = {
|
||||
name: 'avatar',
|
||||
name: 'pic',
|
||||
description: 'Affiche l\'avatar d\'un utilisateur',
|
||||
category: 'utils',
|
||||
utilisation: 'pic [@user/userId]',
|
||||
async execute(message, args, client) {
|
||||
let user;
|
||||
if (message.mentions.users.size > 0) {
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
const { EmbedBuilder, StringSelectMenuBuilder, ActionRowBuilder } = require("discord.js")
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
description: 'Affiche la liste des commandes',
|
||||
category: 'other',
|
||||
emote: '📚',
|
||||
utilisation: 'help [commande]',
|
||||
async execute(message, args, client) {
|
||||
if (args[0]) {
|
||||
// L'utilisateur a fourni un argument, affichez l'aide pour cette commande
|
||||
const command = client.commands.get(args[0]);
|
||||
if (!command) {
|
||||
return message.reply(`Je n'ai pas trouvé de commande nommée "${args[0]}".`);
|
||||
}
|
||||
|
||||
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: `\`+${command.utilisation ? ` **${command.utilisation}**` : ''}\``, inline: true },
|
||||
{ name: 'Catégorie', value: command.category || 'Non spécifiée', inline: true }
|
||||
);
|
||||
|
||||
return message.reply({ embeds: [embed_command] });
|
||||
}
|
||||
|
||||
|
||||
const categories = {
|
||||
antiraid: [],
|
||||
botcontrol: [],
|
||||
game: [],
|
||||
gestion: [],
|
||||
utils: [],
|
||||
other: [],
|
||||
// Ajoutez plus de catégories si nécessaire
|
||||
};
|
||||
|
||||
// Organisez les commandes par catégorie
|
||||
for (const command of client.commands.values()) {
|
||||
if (command.category) {
|
||||
categories[command.category].push({ name: command.name, description: command.description, emote: command.emote, utilisation: command.utilisation});
|
||||
}
|
||||
}
|
||||
|
||||
let description = 'Sélectionnez une catégorie parmi les options ci-dessous pour obtenir de l\'aide sur les commandes correspondantes.\n\n';
|
||||
|
||||
for (const [category, commands] of Object.entries(categories)) {
|
||||
description += `**Catégorie ${category}**\n`;
|
||||
description += commands.length > 0 ? '> ' + commands.map(command => `\`${command.name}\``).join(', ') : '> Aucune commande dans cette catégorie';
|
||||
description += '\n\n';
|
||||
}
|
||||
|
||||
const embeds = {
|
||||
home: new EmbedBuilder()
|
||||
.setColor('#0099ff')
|
||||
.setTitle('📚 Information')
|
||||
.setDescription(description)
|
||||
.setThumbnail(message.guild.iconURL())
|
||||
};
|
||||
|
||||
// Créez un embed pour chaque catégorie
|
||||
for (const [category, commands] of Object.entries(categories)) {
|
||||
let description;
|
||||
if (commands.length > 0) {
|
||||
description = commands.map(command => `${command.emote ? ` ${command.emote}` : '🔧'} **+${command.utilisation ? ` ${command.utilisation}` : ''}**\n \`${command.description}\``).join('\n');
|
||||
} else {
|
||||
description = 'Aucune commande dans cette catégorie.';
|
||||
}
|
||||
|
||||
embeds[category] = new EmbedBuilder()
|
||||
.setColor('#0099ff')
|
||||
.setTitle(`Catégorie ${category}`)
|
||||
.setDescription(description);
|
||||
}
|
||||
|
||||
const menu = new StringSelectMenuBuilder()
|
||||
.setCustomId('help_menu')
|
||||
.setPlaceholder('Sélectionnez une catégorie')
|
||||
.addOptions([
|
||||
{ label: 'Accueil', value: 'home' },
|
||||
...Object.keys(categories).map(category => ({ label: `Catégorie ${category}`, value: category })),
|
||||
]);
|
||||
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(menu);
|
||||
|
||||
const sentMessage = await message.reply({ embeds: [embeds.home], components: [row] });
|
||||
|
||||
const filter = i => i.customId === 'help_menu' && i.user.id === message.author.id;
|
||||
const collector = sentMessage.createMessageComponentCollector({ filter, time: 60000 });
|
||||
collector.on('collect', async (interaction) => {
|
||||
await interaction.update({ embeds: [embeds[interaction.values[0]]] });
|
||||
});
|
||||
|
||||
collector.on('end', () => {
|
||||
sentMessage.edit({ components: [] });
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -2,7 +2,9 @@ const { ButtonStyle, ButtonBuilder, ActionRowBuilder } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'ping',
|
||||
description: 'Command to check the latency of the bot.',
|
||||
description: 'Avoir la latence du bot.',
|
||||
emote: '⏱️',
|
||||
utilisation: 'ping',
|
||||
category: 'utils',
|
||||
async execute(message, args, client) {
|
||||
const ping = new ButtonBuilder()
|
||||
|
||||
@@ -2,27 +2,25 @@ const { EmbedBuilder } = require("discord.js")
|
||||
module.exports = {
|
||||
name: 'serverinfo',
|
||||
description: 'Affiche les informations sur le serveur',
|
||||
emote: '📄',
|
||||
utilisation: 'serverinfo',
|
||||
category: 'utils',
|
||||
|
||||
async execute(message, args, client) {
|
||||
const embed = new EmbedBuilder()
|
||||
.setAuthor({name: `${message.guild.name}`, iconURL: message.guild.iconURL({dynamic : true})})
|
||||
.setDescription(`**ID :** ${message.guild.id}
|
||||
**Nom :** ${message.guild.name}
|
||||
**Propriétaire :** ${message.guild.owner}
|
||||
**Créé le :** <t:${Math.round(message.guild.createdTimestamp / 1000)}:F>
|
||||
**Membres :** ${message.guild.memberCount}
|
||||
**Salons :** ${message.guild.channels.cache.size}
|
||||
**Rôles :** ${message.guild.roles.cache.size}
|
||||
**Emojis :** ${message.guild.emojis.cache.size}
|
||||
**Boosts :** ${message.guild.premiumSubscriptionCount}
|
||||
**Niveau de boost :** ${message.guild.premiumTier}
|
||||
**Région :** ${message.guild.region}
|
||||
**Niveau de vérification :** ${message.guild.verificationLevel}
|
||||
**Notifications :** ${message.guild.defaultMessageNotifications}
|
||||
**Système de vérification :** ${message.guild.explicitContentFilter}
|
||||
**Niveau de vérification :** ${message.guild.verificationLevel}
|
||||
`)
|
||||
.setThumbnail(message.guild.iconURL({dynamic : true}))
|
||||
.setColor("#FFFFFF")
|
||||
.setTitle(`Information du bot \`${client.user.username}\``)
|
||||
.setThumbnail(client.user.displayAvatarURL({dynamic: true}))
|
||||
.addFields([
|
||||
{ name: '📚 Nom', value: `\`${client.user.username}\``, inline: true },
|
||||
{ name: '🆔 ID', value: `\`${client.user.id}\``, inline: true },
|
||||
{ name: '👨💻 Développeur', value: `\`valou336\` && \`tuturp33\``},
|
||||
{ name: '⏳ Uptime', value: `\`\`\`${Math.round(client.uptime / (1000 * 60 * 60))}h ${Math.round(client.uptime / (1000 * 60)) % 60}m ${Math.round(client.uptime / 1000) % 60}\`\`\``},
|
||||
{ name: '➡️ Discord Version', value: `\`${require('discord.js').version}\``, inline: true },
|
||||
{ name: '⏯️ Node Version', value: `\`${process.version}\``, inline: true }
|
||||
])
|
||||
.setTimestamp()
|
||||
.setFooter({text: `${client.user.tag} © 2024`, iconURL: client.user.displayAvatarURL({dynamic: true})});
|
||||
|
||||
message.reply({ embeds: [embed] });
|
||||
},
|
||||
|
||||
@@ -2,7 +2,10 @@ const { EmbedBuilder, User } = require("discord.js")
|
||||
module.exports = {
|
||||
name: 'snipe',
|
||||
description: 'Affiche le dernier message supprimé dans le salon',
|
||||
emote: '🔍',
|
||||
utilisation: 'snipe',
|
||||
category: 'utils',
|
||||
|
||||
async execute(message, args, client) {
|
||||
// Récupère le dernier message supprimé du salon
|
||||
let snipe = client.snipes.get(message.channel.id);
|
||||
|
||||
@@ -2,7 +2,10 @@ const { EmbedBuilder } = require("discord.js")
|
||||
module.exports = {
|
||||
name: 'userinfo',
|
||||
description: 'Affiche les informations sur un utilisateur',
|
||||
emote: '👤',
|
||||
utilisation: 'userinfo',
|
||||
category: 'utils',
|
||||
|
||||
async execute(message, args, client) {
|
||||
let user;
|
||||
if (args.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user