When someone tries to show the queue of a really big playlist, the bot crashes with the error: DiscordAPIError: Invalid Form Body data.embeds[0].description: Must be 4096 or fewer in length.
This is the code that shows the queue:
case "queue" :
return interaction.reply({embeds: [new MessageEmbed()
.setColor("PURPLE")
.setDescription(`${queue.songs.map(
(song, id) => `\n**${id + 1}**. ${song.name} - \`${song.formattedDuration}\`` )}`
)]});
Its exactly what the error says. Discord embed limitations: (https://discord.com/developers/docs/resources/channel#embed-limits)
Ur embed description must have less then 4096 characters. You can just use a function to trim the description
function shorten(str) {
if (str.length > 1000) {
return str.substring(0, 1001) + '...';
} else {
return str;
}
}
You could optionally make pages in your embed that divides ur queue into two parts and shows the second list when reacting