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

254
Visualizações
Expected the value to be an object, but received string instead

I’ve recently updated to v14 of discordjs (I think), and I’ve been getting tons of errors as this being one of many. And it seems a lot of stuff has changed since the last time I coded and I’m a bit confused about what I need to change in order for this ping slash command to work.

Error Expected the value to be an object, but received string instead

Code

const { EmbedBuilder } = require("discord.js");

module.exports = {
  name: "ping",
  description: "Displays Crimson's API and Latency ping!",
  options: null,
  run: async (client, interaction, args) => {    
    const pingEmbed1 = new EmbedBuilder()
      .setTitle("Pinging...")
      .setColor("#fb644c");

    const pingMsg = await interaction.reply({ embeds: [pingEmbed1], fetchReply: true });

    try {      
      const pingEmbed2 = new EmbedBuilder()
        .setTitle("Pong!")
        .setDescription(`⌛ Latency: \`${Math.floor(pingMsg.createdTimestamp - interaction.createdTimestamp)}ms\`\n⏲️ API: \`${Math.round(client.ws.ping)}ms\``)
        .setFooter(`Command Requested by: ${interaction.user.tag}`, interaction.user.displayAvatarURL())
        .setColor("#fb644c");
      await interaction.editReply({ embeds: [pingEmbed2] });
    } catch (err) {
        console.log(err);
        return interaction.editReply(`\`${err.message}\`.`);
    }
  },
};

Now just to be clear, so people don’t get mad at me for not trying… I did change a few things that were changed such as the new embed builder and so on.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

In discord.js v14, EmbedBuilder#setFooter() accepts a sole FooterOptions object. You will need to provide an object with a text and an iconURL keys:

const pingEmbed2 = new EmbedBuilder()
  .setTitle('Pong!')
  .setDescription(
    `⌛ Latency: \`${Math.floor(
      pingMsg.createdTimestamp - interaction.createdTimestamp,
    )}ms\`\n⏲️ API: \`${Math.round(client.ws.ping)}ms\``,
  )
  .setFooter({
    text: `Command Requested by: ${interaction.user.tag}`,
    iconURL: interaction.user.displayAvatarURL(),
  })
  .setColor('#fb644c');
about 4 years ago · Santiago Trujillo 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