Error fetching avatar
I included the code and console log below
discord.js version 14.15.2
21 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!log the error?
Error fetching avatar for koneko_chann (705648196428496970): Unsupported image type
Again, log the error, not your own error message
umm how do i log it
console.error(e)
You're leaving out important information when you're only providing the error message and nothing else
Given that you're also using canvas in that
try
block, the error may be originating from canvas and not via fetching the image buffer itself
As a separate FYI, the MessageAttachment class was renamed in v14 to Attachment builder - not sure if you selected the wrong version tag or simply used the wrong importhmm I want the code to take all member's avatar in a server and draw it in a photo like this
And on that note, you can pass a buffer directly as the first parameter of it, which negates the need to write the image to a file, only for it to be read by d.js internally immediately after
And I'm once again asking you to log the whole error
im sorry im new idk how to log it
I literally told you
:IRT_This:
chances are the avatar url ends in webp and canvas doesn't like that
you can force the avatar url to be returned in png (and force it static if its a gif)
I'll try
Which I guess is a good segue to also mention that the option for
avatarURL()
to set the image type was also renamed from format
to extension
in v14also a good segue to also mention that you should use displayAvatarURL() instead, otherwise you have to expect avatarURL() to return null if the user doesn't have an avatar
(Though
user
seems to be a GuildMember in this case, it still functions the same)