image in embed
I'm working on something and I'm genuinely confused why this doesn't work. I've looked at previous questions about it but none of it works for me. I've tried both with EmbedBuilder and embed object, but both dont work
the image is made with the AttachmentBuilder and canvas:
as you can probably tell, I've tried sending the image as file, and that does work and show the image.
this is what the console.log(image) shows;
could anyone possibly help me?
5 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!
- ✅
Marked as resolved by OPcould you log
image.url
?
if image
is an instance of attachment builder, url doesnt exists
because for a url to exists, it must be sent first
the attchment://
protocol takes a file name, not a url
be sure to include your last comment too
// files: [image]
becuase thats the piece of code that actually uploads the file to discordyou're right, image does not have an image.url, I've tried with image.name (and logged it), but this doesn't work either. the log gives
rank-card.png
isn't that to send it as file attachment and not as embed image tho?you still need to send the file regardless of if you want to display it inside attachment or not. the
attachment://
protocol will make it inside the embed
https://discordjs.guide/popular-topics/embeds.html#attaching-imagesI totally overlooked that in the guide, my fault. this works thanks!