mirror of
https://github.com/arthur-pbty/bot-discord-coins.git
synced 2026-06-26 06:32:56 +02:00
format all file
This commit is contained in:
+291
-191
@@ -1,191 +1,291 @@
|
||||
const { EmbedBuilder, ButtonStyle, ButtonBuilder, ActionRowBuilder } = require('discord.js');
|
||||
const embedColor = require('../../fonctions/embedColor.js');
|
||||
const getPrefix = require('../../fonctions/getPrefix.js');
|
||||
|
||||
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 });
|
||||
});
|
||||
|
||||
let commandsList = '';
|
||||
uniqueCommands.forEach((command, name) => {
|
||||
commandsList += `> ${command.emote} \`${prefix}${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) {
|
||||
if (args) {
|
||||
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() });
|
||||
|
||||
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))
|
||||
|
||||
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 rightButton = new ButtonBuilder()
|
||||
.setCustomId('right')
|
||||
.setLabel('▶')
|
||||
.setStyle(ButtonStyle.Primary);
|
||||
|
||||
const row = new ActionRowBuilder()
|
||||
.addComponents(leftButton, rightButton);
|
||||
|
||||
let messageEmbed;
|
||||
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: 120000 });
|
||||
|
||||
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', 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: [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: [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: [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: [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: [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: [embedPage7], components: [row], allowedMentions: { repliedUser: false } });
|
||||
} else if (page === 8) {
|
||||
const embedPage8 = 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 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', 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: [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 } })
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
const {
|
||||
EmbedBuilder,
|
||||
ButtonStyle,
|
||||
ButtonBuilder,
|
||||
ActionRowBuilder,
|
||||
} = require("discord.js");
|
||||
const embedColor = require("../../fonctions/embedColor.js");
|
||||
const getPrefix = require("../../fonctions/getPrefix.js");
|
||||
|
||||
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,
|
||||
});
|
||||
});
|
||||
|
||||
let commandsList = "";
|
||||
uniqueCommands.forEach((command, name) => {
|
||||
commandsList += `> ${command.emote} \`${prefix}${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) {
|
||||
if (args) {
|
||||
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(),
|
||||
});
|
||||
|
||||
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));
|
||||
|
||||
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 rightButton = new ButtonBuilder()
|
||||
.setCustomId("right")
|
||||
.setLabel("▶")
|
||||
.setStyle(ButtonStyle.Primary);
|
||||
|
||||
const row = new ActionRowBuilder().addComponents(leftButton, rightButton);
|
||||
|
||||
let messageEmbed;
|
||||
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: 120000,
|
||||
});
|
||||
|
||||
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", 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: [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: [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: [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: [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: [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: [embedPage7],
|
||||
components: [row],
|
||||
allowedMentions: { repliedUser: false },
|
||||
});
|
||||
} else if (page === 8) {
|
||||
const embedPage8 = 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 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", 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: [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 },
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user