ajout de largument commande dans la commande help

This commit is contained in:
arthur
2024-06-17 18:00:44 +02:00
parent fb44f67fc9
commit 703c6115d8
+145 -118
View File
@@ -26,140 +26,167 @@ module.exports = {
permission: 0,
async execute(message, args, client) {
const prefix = await getPrefix(message.guild.id);
const embedPage1 = new EmbedBuilder()
.setTitle('📚 ・Information')
.setThumbnail(message.guild.iconURL())
.setDescription(`Voici le panel d'aide du bot. Pour plus d'informations sur une commande, utilisez ${prefix}help <commande>\n\n> **🎙️ Récompenses vocales :**\n> Vous gagnez \`100\` coins toutes les \`15\`minutes lorsque vous êtes en vocal (**NON MUTE** sinon c'est \`50\`coins).\n \n> **📺 Récompenses de streaming :**\n> Activer un stream vous fera gagner \`200\`.\n \n> **📷 Récompenses de caméra :**\n> Activer votre caméra vous fera gagner \`200\`.\n\n> Le coins est une monnaie fictive.`)
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 1/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
const leftButton = new ButtonBuilder()
.setCustomId('left')
.setLabel('◀')
.setStyle(ButtonStyle.Primary);
if (args[0] && client.commands.has(args[0])) {
const command = client.commands.get(args[0]);
const prefix = await getPrefix(message.guild.id);
const embed = new EmbedBuilder()
.setTitle(`📚・${command.name}`)
.setThumbnail(message.guild.iconURL())
.setDescription(`> **Description :** ${command.description}\n> **Utilisation :** \`${prefix}${command.name}${command.utilisation ? ' ' + command.utilisation : ''}\`\n> **Alias :** ${command.aliases.join(', ') || 'Aucun'}\n> **Permission :** ${command.permission}\n> **Catégorie :** ${command.category}\n> **Emote :** ${command.emote}`)
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
const rightButton = new ButtonBuilder()
.setCustomId('right')
.setLabel('▶')
.setStyle(ButtonStyle.Primary);
message.reply({ embeds: [embed], allowedMentions: { repliedUser: false } });
} else {
if (args[0]) {
const embed = new EmbedBuilder()
.setTitle('❌・Commande inconnue')
.setDescription('La commande que vous avez demandée n\'existe pas. Nous vous invitons à vérifier l\'orthographe dans le help si dessous et à réessayer.')
.setColor(await embedColor(message.author.id, message.guild.id))
const row = new ActionRowBuilder()
.addComponents(leftButton, rightButton);
message.reply({ embeds: [embed], allowedMentions: { repliedUser: false } });
}
const prefix = await getPrefix(message.guild.id);
const embedPage1 = new EmbedBuilder()
.setTitle('📚 ・Information')
.setThumbnail(message.guild.iconURL())
.setDescription(`Voici le panel d'aide du bot. Pour plus d'informations sur une commande, utilisez ${prefix}help <commande>\n\n> **🎙️ Récompenses vocales :**\n> Vous gagnez \`100\` coins toutes les \`15\`minutes lorsque vous êtes en vocal (**NON MUTE** sinon c'est \`50\`coins).\n \n> **📺 Récompenses de streaming :**\n> Activer un stream vous fera gagner \`200\`.\n \n> **📷 Récompenses de caméra :**\n> Activer votre caméra vous fera gagner \`200\`.\n\n> Le coins est une monnaie fictive.`)
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 1/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
const leftButton = new ButtonBuilder()
.setCustomId('left')
.setLabel('◀')
.setStyle(ButtonStyle.Primary);
const messageEmbed = await message.reply({ embeds: [embedPage1], components: [row], allowedMentions: { repliedUser: false } });
const rightButton = new ButtonBuilder()
.setCustomId('right')
.setLabel('▶')
.setStyle(ButtonStyle.Primary);
const filter = i => i.user.id === message.author.id;
const collector = message.channel.createMessageComponentCollector({ filter, time: 90000 });
const row = new ActionRowBuilder()
.addComponents(leftButton, rightButton);
let page = 1;
collector.on('collect', async i => {
if (i.customId === 'left') {
page--;
if (page < 1) page = 10;
} else if (i.customId === 'right') {
page++;
if (page > 10) page = 1;
let messageEmbed;
if (args[0]) {
messageEmbed = await message.channel.send({ embeds: [embedPage1], components: [row], allowedMentions: { repliedUser: false } });
} else {
messageEmbed = await message.reply({ embeds: [embedPage1], components: [row], allowedMentions: { repliedUser: false } });
}
if (page === 1) {
i.update({ embeds: [embedPage1], components: [row] });
} else if (page === 2) {
const embedPage2 = new EmbedBuilder()
.setTitle('💰・Casino')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'casino', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 2/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
const filter = i => i.user.id === message.author.id;
const collector = message.channel.createMessageComponentCollector({ filter, time: 90000 });
i.update({ embeds: [embedPage2], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 3) {
const embedPage3 = new EmbedBuilder()
.setTitle('🎲・Jeux')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'jeux', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 3/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
let page = 1;
collector.on('collect', async i => {
if (i.customId === 'left') {
page--;
if (page < 1) page = 10;
} else if (i.customId === 'right') {
page++;
if (page > 10) page = 1;
}
i.update({ embeds: [embedPage3], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 4) {
const embedPage4 = new EmbedBuilder()
.setTitle('🛍️・Achats')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'achats', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 4/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
if (page === 1) {
i.update({ embeds: [embedPage1], components: [row] });
} else if (page === 2) {
const embedPage2 = new EmbedBuilder()
.setTitle('💰・Casino')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'casino', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 2/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage4], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 5) {
const embedPage5 = new EmbedBuilder()
.setTitle('🏭・Metier et capacité')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'jobs', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 5/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage2], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 3) {
const embedPage3 = new EmbedBuilder()
.setTitle('🎲・Jeux')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'jeux', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 3/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage5], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 6) {
const embedPage6 = new EmbedBuilder()
.setTitle('💼・Teams')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'teams', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 6/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage3], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 4) {
const embedPage4 = new EmbedBuilder()
.setTitle('🛍️・Achats')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'achats', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 4/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage6], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 7) {
const embedPage7 = new EmbedBuilder()
.setTitle('🛡️・Teams administration')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'teams admin', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 7/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage4], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 5) {
const embedPage5 = new EmbedBuilder()
.setTitle('🏭・Metier et capacité')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'jobs', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 5/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage7], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 8) {
const embedPage8 = new EmbedBuilder()
.setTitle('🤝・Alliance')
.setThumbnail(message.guild.iconURL())
.setDescription(`page 8`)
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 8/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage5], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 6) {
const embedPage6 = new EmbedBuilder()
.setTitle('💼・Teams')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'teams', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 6/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage8], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 9) {
const embedPage9 = new EmbedBuilder()
.setTitle('👑・Gestion')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'gestion', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 9/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage6], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 7) {
const embedPage7 = new EmbedBuilder()
.setTitle('🛡️・Teams administration')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'teams admin', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 7/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage9], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 10) {
const embedPage10 = new EmbedBuilder()
.setTitle('👑・Bot control')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'bot control', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 10/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage7], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 8) {
const embedPage8 = new EmbedBuilder()
.setTitle('🤝・Alliance')
.setThumbnail(message.guild.iconURL())
.setDescription(`page 8`)
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 8/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage10], components: [row], allowedMentions: { repliedUser: false } });
}
});
i.update({ embeds: [embedPage8], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 9) {
const embedPage9 = new EmbedBuilder()
.setTitle('👑・Gestion')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'gestion', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 9/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
collector.on('end', () => {
messageEmbed.edit({ components: [], allowedMentions: { repliedUser: false } })
});
i.update({ embeds: [embedPage9], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 10) {
const embedPage10 = new EmbedBuilder()
.setTitle('👑・Bot control')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'bot control', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 10/10 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage10], components: [row], allowedMentions: { repliedUser: false } });
}
});
collector.on('end', () => {
messageEmbed.edit({ components: [], allowedMentions: { repliedUser: false } })
});
}
}
};