0

Im trying to add a command to my bot, said command will display the avatar of whoever is mentioned. For example >pfp @user1 would display user1's avatar.

However my code is returning an error of message.member.displayAvatarURL(); is not a function

let member = message.mentions.members.first();

    if(member){
        message.member.displayAvatarURL();
    }

What would be the appropriate syntax to execute this?

Elitezen
  • 6,551
  • 6
  • 15
  • 29

1 Answers1

2

displayAvatarURL is a function on User, not GuildMember.

You can either get the user from the member like this:

message.member.user.displayAvatarURL();

or just directly use the author property:

message.author.displayAvatarURL();
Lauren Yim
  • 12,700
  • 2
  • 32
  • 59