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

422
Visualizações
Getting 'undefined' .hexAccentColor value even when force fetching user?

I'm trying to create an info command that pulls the specified users info. As per the discord.js docs, I'm force fetching the specified user to get the .hexAccentColor. The user I'm fetching does have an accent color, yet I get undefined as the value every time I try to get it. Here is my code:

const user = await client.users.fetch(
      interaction.options.getUser("user"),
      false,
      true
    );
    const embed = new MessageEmbed()
      .setColor(`${user.hexAccentColor}`)
      .setTitle(`User info for ${user.username}`)
      .addFields(
        { name: "User Tag:", value: `${user.tag}`, inline: true },
        { name: "User ID:", value: `${user.id}`, inline: true },
        { name: "Bot Status:", value: `${user.bot}`, inline: true },
        {
          name: "Account Creation Date:",
          value: `${user.createdAt}`,
          inline: false,
        }
      )
      .setImage(`${user.displayAvatarURL()}`);

All the other information is being passed correctly, it's just the color values that I'm getting undefined for.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You aren't actually force fetching. The arguments aren't correct (see UserManager#fetch()). Here's how to force fetch a user

const user = await client.users.fetch(
    interaction.options.getUser("user"),
    {
      force: true
    }
)

But rather than fetching like this, you could do a simple User#fetch(), since interaction.options.getUser returns a User instance

const user = await interaction.options.getUser("user").fetch(true)
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