title: How to display mentiones users avatar in an embed discord.js
body: <p>I'm trying to make a user info command, but I've run into a problem with displaying people's avatars. My command is supposed to respond to this: <code>&amp;profile {user ping/user ID}</code>.</p>
  <p>So, if you do <code>&amp;profile @user#0001</code>, it will display the info of <code>user#0001</code>. If you do <code>&amp;profile 123456789123456789</code>, it will display info about the user with ID <code>123456789132456</code>. If you do <code>&amp;profile</code> without a mention, it will display info about you.</p>
  <p>Whenever I run <code>&amp;profile</code>, it posts the embed without problems. But, if I mention someone or put someone's ID, it crashes. This is my code:</p>
  <pre class="lang-js prettyprint-override"><code>const { DiscordAPIError } = require(&quot;discord.js&quot;);
  const Discord = require(&quot;discord.js&quot;);
  
  module.exports = {
    name: &quot;profile&quot;,
    description: &quot;The bot will return the info about the user&quot;,
    execute(message, args) {
      let userinfoget =
        message.guild.member(message.mentions.members.first()) ||
        message.guild.members.cache.get(args[0]);
      //var userinfoget = message.mentions.members.first();
      //var patter = message.author;
      //var randompatemote = Math.floor(Math.random() * 3) + 1;
      if (!userinfoget) {
        userinfoget = message.author;
      }
  
      console.log(`User = ${userinfoget}`);
  
      const embed = new Discord.MessageEmbed()
        .setTitle(`User info`)
        .setColor(&quot;#DAF7A6&quot;)
        .setAuthor(`${userinfoget.tag}`, userinfoget.displayAvatarURL())
        .addFields({ name: `${userinfoget.tag}`, value: `Here will be the ID` });
      message.channel.send(embed);
    },
  };
  </code></pre>
  <p>When I mention someone, it throws the error:</p>
  <pre><code>userinfoget.displayAvatarURL is not a function
  </code></pre>
  <p>The same thing happened if I put an ID. But if I put nothing behind the command (so it displays my info), it works. An example of what I'm trying to get is in the attachment.</p>
  <p><a href="https://i.stack.imgur.com/hW4e1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hW4e1.png" alt="Example" /></a></p>
  <p>It displays in the embed correctly, but only if it displays mine, otherwise it crashes. Any way to fix it?</p>