Reputation: 3
Firts, sorry for my poor english
I start to learn js and I want to detect image in a message from the server users and reply this in an embed, bot message.content not working for that.
if (msg.content.startsWith(`${prefi}tw`)) { // the command for te announcement
const embed = new RichEmbed()
.setColor("#3ded97") //message line color "Green"
.setImage(msg.content()) //Image from the message
.setFooter(`God • ${dia.toLocaleDateString()}`); //The base from the text with date and the sender
msg.delete(); //Delete the message from the user
msg.channel.send(embed);
}
Thanks my friends :'') H
Upvotes: 0
Views: 130
Reputation: 26
I think you could get the image by using msg.attachments.url
which returns the url of the message attachment (in this case an image)
Doc : https://discord.js.org/#/docs/discord.js/stable/class/MessageAttachment
Also, if you're using discord.js V13, to send embeds I think you should use msg.channel.send({ embeds: [embed] })
instead of msg.channel.send(embed)
Edit : If you're using discord.js V12 or greater, use MessageEmbed()
instead of RichEmbed()
Upvotes: 1