problème réglé sur l'embed

This commit is contained in:
Lantium 2022-04-18 22:12:21 +02:00
parent 1dce385e20
commit 5bac7f38f3

View File

@ -1,35 +1,34 @@
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
module.exports = { module.exports = {
name: 'queue', name: 'queue',
aliases: ['q'], aliases: ['q'],
utilisation: '{prefix}queue', utilisation: '{prefix}queue',
voiceChannel: true, voiceChannel: true,
execute(client, message) { async execute (client, message) {
const queue = player.getQueue(message.guild.id); const queue = player.getQueue(message.guild.id);
if (!queue) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`); if (!queue) return message.channel.send(`No music currently playing ${message.author}... try again ? ❌`);
if (!queue.tracks[0]) return message.channel.send(`No music in the queue after the current one ${message.author}... try again ? ❌`); if (!queue.tracks[0]) return message.channel.send(`No music in the queue after the current one ${message.author}... try again ? ❌`);
const embed = new MessageEmbed(); const embed = new MessageEmbed();
const methods = ['', '🔁', '🔂']; const methods = ['', '🔁', '🔂'];
embed.setColor('RED'); embed.setColor('RED');
embed.setThumbnail(message.guild.iconURL({ size: 2048, dynamic: true })); embed.setThumbnail(message.guild.iconURL({ dynamic: true }));
embed.setAuthor(`Server queue - ${message.guild.name} ${methods[queue.repeatMode]}`, client.user.displayAvatarURL({ size: 1024, dynamic: true })); embed.setAuthor(`Server queue - ${message.guild.name} ${methods[queue.repeatMode]}`, client.user.displayAvatarURL({ dynamic: true }));
const tracks = queue.tracks.map((track, i) => `**${i + 1}** - ${track.title} | ${track.author} (requested by : ${track.requestedBy.username})`); const tracks = queue.tracks.map((track, i) => `**${i + 1}** - ${track.title} | ${track.author} (requested by : ${track.requestedBy.username})`);
const songs = queue.tracks.length; const songs = queue.tracks.length;
const nextSongs = songs > 5 ? `And **${songs - 5}** other song(s)...` : `In the playlist **${songs}** song(s)...`; const nextSongs = songs > 5 ? `And **${songs - 5}** other song(s)...` : `In the playlist **${songs}** song(s)...`;
embed.setDescription(`Current ${queue.current.title}\n\n${tracks.slice(0, 5).join('\n')}\n\n${nextSongs}`); embed.setDescription(`Current ${queue.current.title}\n\n${tracks.slice(0, 5).join('\n')}\n\n${nextSongs}`);
embed.setTimestamp(); embed.setTimestamp();
embed.setFooter(message.author.avatarURL({ dynamic: true }));
message.channel.send({ embeds: [embed] }); message.channel.send({ embeds: [embed] });
}, }
}; };