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
  • 5,419
  • 5
  • 13
  • 28

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();
cherryblossom
  • 9,700
  • 2
  • 24
  • 53