Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

419
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!