Display Attachment in Embed
The attachment option returns:
https://media.discordapp.net/attachments/889518013429194782/1136474759866109952/image.png
How would I get the image URL so I can use it to set it as the image in an embed?
7 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!Not sure why you get your option values like that
You can just do
interaction.options.getAttachment('attachment').url
![](https://cdn.answeroverflow.com/1136489462134743122/image.png)
I am using @djs/core /rest /ws
further attachment data such as
<APIAttachment>.url
would be found in the resolved data
<APIApplicationCommandInteraction>.data.resolved.attachments
is keyed by id (the value of the option)
if you're using /core, you'll want to reference and familiarize yourself with the discord api docs directlygot it, thank you