Skip to content
Advertisement

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:

JavaScript

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

Advertisement

Answer

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

JavaScript

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

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement