avatarURL function is broken?
Hey. I've been making a website with an integration through a Discord bot to get a staff list and its information.
I've came accross an issue with the avatarURL function always returning
null
(I use an alternative for now, displayAvatarURL().
Here the code of the staff route:
And here is where I login the bot in the structures/app.ts
file:
4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!Thats not broken. It can return null.
For when they dont have an avatar
So avatarURL() function returns the custom avatar on a server or what?
As every member has an avatar, but I can only retrieve it using the displayAvatarURL()
Depends if you're calling it on a GuildMember or User, but yes, that's the point of the methods
avatarURL() will return null if they don't have one
displayAvatarURL() will default to a higher level avatar