Reputation: 18
I have a question about adding the avatarUrl from an user mentioned. I've done the code but it doesn't show the image when sending the embed. There's also not error in the console.
const user = message.mentions.users.first();
var mention = "<@" + user.id + ">"
var userCreated = user.createdAt.toString().split(" ");
var userJoined = user.userJoined
const Embed = new Discord.MessageEmbed()
.setTitle(user.tag)
.setDescription(mention)
.setColor("#b60303")
.addFields(
{ name: "Registered at", value: userCreated[1] + " " + userCreated[2] + ", " + userCreated[3]},
{ name: "ID", value: user.id, inline: true}
)
.setImage(message.avatarURL)
.setTimestamp()
.setFooter("ID: " + user.id)
message.channel.send(Embed)
}```
Upvotes: 0
Views: 72
Reputation: 6625
Messages don't have avatar URLs, and in Discord JS v12, avatarURL
is a method.
.setImage(message.author.avatarURL())
Upvotes: 1