mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-03 23:36:29 +02:00
163 lines
7.8 KiB
JavaScript
163 lines
7.8 KiB
JavaScript
const { EmbedBuilder, ButtonStyle, ButtonBuilder, ActionRowBuilder } = require('discord.js');
|
|
const embedColor = require('../../fonctions/embedColor.js');
|
|
|
|
function commandsList (client, category) {
|
|
const casinoCommands = client.commands.filter(command => command.category === category).sort((a, b) => a.name.localeCompare(b.name));
|
|
const uniqueCommands = new Map();
|
|
|
|
casinoCommands.forEach(command => {
|
|
uniqueCommands.set(command.name, {description: command.description, emote: command.emote, utilisation: command.utilisation});
|
|
});
|
|
|
|
let commandsList = '';
|
|
uniqueCommands.forEach((command, name) => {
|
|
commandsList += `${command.emote} \`${name}${command.utilisation ? ' ' + command.utilisation : ''}\`\n┖ ${command.description}\n\n`;
|
|
});
|
|
|
|
return commandsList;
|
|
}
|
|
|
|
module.exports = {
|
|
aliases: ['h', 'aide'],
|
|
description: 'Affiche la liste des commandes disponibles',
|
|
emote: '📚',
|
|
utilisation: '[commande]',
|
|
permission: 0,
|
|
|
|
async execute(message, args, client) {
|
|
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 &help <commande>\n\n> **🎙️ Récompenses vocales :**\n> Vous gagnez \`100\` pièces toutes les 15 minutes lorsque vous êtes en vocal.\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 rightButton = new ButtonBuilder()
|
|
.setCustomId('right')
|
|
.setLabel('▶')
|
|
.setStyle(ButtonStyle.Primary);
|
|
|
|
const row = new ActionRowBuilder()
|
|
.addComponents(leftButton, rightButton);
|
|
|
|
const messageEmbed = await message.reply({ embeds: [embedPage1], components: [row], allowedMentions: { repliedUser: false } });
|
|
|
|
const filter = i => i.user.id === message.author.id;
|
|
const collector = message.channel.createMessageComponentCollector({ filter, time: 60000 });
|
|
|
|
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;
|
|
}
|
|
|
|
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'))
|
|
.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: [embedPage2], components: [row], allowedMentions: { repliedUser: false } });
|
|
} else if (page === 3) {
|
|
const embedPage3 = new EmbedBuilder()
|
|
.setTitle('🎲 Jeux')
|
|
.setThumbnail(message.guild.iconURL())
|
|
.setDescription(commandsList(client, 'jeux'))
|
|
.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: [embedPage3], components: [row], allowedMentions: { repliedUser: false } });
|
|
} else if (page === 4) {
|
|
const embedPage4 = new EmbedBuilder()
|
|
.setTitle('🛍️ Achats')
|
|
.setThumbnail(message.guild.iconURL())
|
|
.setDescription(commandsList(client, 'achats'))
|
|
.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: [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'))
|
|
.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: [embedPage5], components: [row], allowedMentions: { repliedUser: false } });
|
|
} else if (page === 6) {
|
|
const embedPage6 = new EmbedBuilder()
|
|
.setTitle('🛡️ Teams')
|
|
.setThumbnail(message.guild.iconURL())
|
|
.setDescription(commandsList(client, 'teams'))
|
|
.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: [embedPage6], components: [row], allowedMentions: { repliedUser: false } });
|
|
} else if (page === 7) {
|
|
const embedPage7 = new EmbedBuilder()
|
|
.setTitle('💼 Teams 2')
|
|
.setThumbnail(message.guild.iconURL())
|
|
.setDescription(`page 7`)
|
|
.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: [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: [embedPage8], components: [row], allowedMentions: { repliedUser: false } });
|
|
} else if (page === 9) {
|
|
const embedPage9 = new EmbedBuilder()
|
|
.setTitle('👑 Gestion')
|
|
.setThumbnail(message.guild.iconURL())
|
|
.setDescription(commandsList(client, 'gestion'))
|
|
.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: [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'))
|
|
.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 } })
|
|
});
|
|
}
|
|
}; |