Reputation: 3
So when trying to make my Discord.js bot display an User Avatar, it works with other bots but not with actual users, I have this problem on all commands that use user.avatarURL
This is the code I am using
const user = message.mentions.users.first();
if(message.content.toLowerCase().startsWith(`${prefix}av`)){
let member = message.mentions.members.first();
if(member){
const emb=new Discord.MessageEmbed()
emb.setAuthor(`${user.username}'s avatar`, user.avatarURL())
emb.setImage(user.avatarURL());
message.channel.send(emb)
}
else{
message.channel.send("Sorry none found with that name")
}
Upvotes: 0
Views: 124
Reputation: 957
You should use displayAvatarURL instead, with the optional dynamic option.
emb.setAuthor(`Text`, user.displayAvatarURL({ dynamic: true }));
https://discord.js.org/#/docs/main/stable/class/User?scrollTo=displayAvatarURL
Upvotes: 1