Add alliances sys (partit 4)

This commit is contained in:
*x1
2024-06-18 17:35:03 +02:00
parent 6e8e44924b
commit 0af531a11a
+27 -17
View File
@@ -2,12 +2,12 @@ const { EmbedBuilder, ButtonStyle, ButtonBuilder, ActionRowBuilder } = require('
const embedColor = require('../../fonctions/embedColor.js');
const getPrefix = require('../../fonctions/getPrefix.js');
function commandsList (client, category, prefix) {
function commandsList(client, category, prefix) {
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});
uniqueCommands.set(command.name, { description: command.description, emote: command.emote, utilisation: command.utilisation });
});
let commandsList = '';
@@ -21,7 +21,7 @@ function commandsList (client, category, prefix) {
module.exports = {
aliases: ['h', 'aide'],
description: 'Affiche la liste des commandes disponibles',
emote: '📚',
emote: '📚',
utilisation: '[commande]',
permission: 0,
@@ -54,8 +54,8 @@ module.exports = {
.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() });
.setFooter({ text: `Page 1/11 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
const leftButton = new ButtonBuilder()
.setCustomId('left')
.setLabel('◀')
@@ -77,16 +77,16 @@ module.exports = {
}
const filter = i => i.user.id === message.author.id;
const collector = message.channel.createMessageComponentCollector({ filter, time: 90000 });
const collector = message.channel.createMessageComponentCollector({ filter, time: 120000 });
let page = 1;
collector.on('collect', async i => {
if (i.customId === 'left') {
page--;
if (page < 1) page = 10;
if (page < 1) page = 11;
} else if (i.customId === 'right') {
page++;
if (page > 10) page = 1;
if (page > 11) page = 1;
}
if (page === 1) {
@@ -98,7 +98,7 @@ module.exports = {
.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() });
.setFooter({ text: `Page 2/11 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage2], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 3) {
@@ -108,7 +108,7 @@ module.exports = {
.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() });
.setFooter({ text: `Page 3/11 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage3], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 4) {
@@ -118,7 +118,7 @@ module.exports = {
.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() });
.setFooter({ text: `Page 4/11 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage4], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 5) {
@@ -128,7 +128,7 @@ module.exports = {
.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() });
.setFooter({ text: `Page 5/11 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage5], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 6) {
@@ -138,7 +138,7 @@ module.exports = {
.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() });
.setFooter({ text: `Page 6/11 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage6], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 7) {
@@ -148,7 +148,7 @@ module.exports = {
.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() });
.setFooter({ text: `Page 7/11 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage7], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 8) {
@@ -158,7 +158,7 @@ module.exports = {
.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() });
.setFooter({ text: `Page 8/11 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage8], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 9) {
@@ -168,7 +168,7 @@ module.exports = {
.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() });
.setFooter({ text: `Page 9/11 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage9], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 10) {
@@ -178,7 +178,17 @@ module.exports = {
.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() });
.setFooter({ text: `Page 10/11 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage10], components: [row], allowedMentions: { repliedUser: false } });
} else if (page === 11) {
const embedPage10 = new EmbedBuilder()
.setTitle('👑・Alliance')
.setThumbnail(message.guild.iconURL())
.setDescription(commandsList(client, 'Alliance', prefix))
.setColor(await embedColor(message.author.id, message.guild.id))
.setTimestamp()
.setFooter({ text: `Page 11/11 | Demandé par ${message.author.tag}`, iconURL: message.author.displayAvatarURL() });
i.update({ embeds: [embedPage10], components: [row], allowedMentions: { repliedUser: false } });
}