Is it possible to get displayAvatarUrl from User interaction option?

My slack command has a User option requirement. From that, I am able to use interaction.options.getUser() to get the User information. But, I am unable to get the displayAvatarUrl.
19 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Kinect3000
Kinect30003y ago
Can you show how you did it?
92bricks
92bricksOP3y ago
How I do what, exactly?
Kinect3000
Kinect30003y ago
Get the user's avatar
92bricks
92bricksOP3y ago
I get the avatar string as part of the User object returned from interaction.options.getUser("user option")
Kinect3000
Kinect30003y ago
How did you access the avatar exactly? Did you just do user.avatar?
92bricks
92bricksOP3y ago
Yes. But that just gives me the avatar string and not the avatar URL like displayAvatarURL would give.
Kinect3000
Kinect30003y ago
Then use displayAvatarURL Can you be more specific on why it’s not working
92bricks
92bricksOP3y ago
I am unable to get displayAvatarURL as part of the returned User object from interaction.options.getUser("user option") .
Kinect3000
Kinect30003y ago
Is there an error? Did the program crash?
92bricks
92bricksOP3y ago
No. displayAvatarURL is literally not part of the User object returned.
Kinect3000
Kinect30003y ago
Yes it is
d.js docs
d.js docs3y ago
method User#displayAvatarURL() A link to the user's avatar if they have one. Otherwise a link to their default avatar will be returned.
Kinect3000
Kinect30003y ago
Not rly sure how you came to that conclusion
92bricks
92bricksOP3y ago
This is what is returned from the user object
User {
id: 'redactd',
bot: false,
system: false,
flags: UserFlagsBitField { bitfield: 4194304 },
username: '92bricks',
discriminator: '4696',
avatar: 'redacted',
banner: undefined,
accentColor: undefined
}
User {
id: 'redactd',
bot: false,
system: false,
flags: UserFlagsBitField { bitfield: 4194304 },
username: '92bricks',
discriminator: '4696',
avatar: 'redacted',
banner: undefined,
accentColor: undefined
}
Kinect3000
Kinect30003y ago
Methods don’t appear in logs
92bricks
92bricksOP3y ago
It does in interaction logs I think you're rightt tho. Thank you
Kinect3000
Kinect30003y ago
Well, unless you implemented some custom logger that magically extracts methods, which is doable but not common to do
92bricks
92bricksOP3y ago
I was able to grab the url from the method Thank you Kinect
Want results from more Discord servers?
Add your server