Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
Getting 'DiscordAPIError: Invalid Form Body' when trying to send an embed

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}\`` )}`
    )]});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda