Get image as arg from message
Is it possible to get the sended image from a command as an argument and send it with the bot?
Like:
!image (I send an image)
And the bot sends the same image.
6 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 OP Message#attachments
A collection of attachments in the message - e.g. Pictures - mapped by their ids. (more...)
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
if (message.attachments.size > 0) {
const attachment = message.attachments.first();
message.reply({ files: [attachment.url] });
}
Like this?
Unknown User•14mo ago
Message Not Public
Sign In & Join Server To View
It works, ty.