title: How to make a rich embed use the display color of a user discord.js
body: <p>I'm working on my user info command. It reacts to &amp;userinfo {user ping/user ID}. If there are no args (no ID or ping), it shows the info about the executer of the command. I was wondering, how I could make the info embed have the same color as the display color of the user (so if my nick color is #0052ad, the embed color would also be #0052ad). The code I came up with so far is this:</p>
  <pre class="lang-js prettyprint-override"><code>const { DiscordAPIError } = require('discord.js');
  const Discord = require('discord.js');
  const moment = require('moment');
  
  module.exports = {
   name: 'profile',
   description: 'The bot will return the info about the user',
   execute(message, args) {
    let userinfoget =
     message.mentions.members.first() ||
     message.guild.members.cache.get(args[0]) ||
     message.guild.member(message.author);
  
    var highestRoleID = userinfoget.roles.highest.id;
    console.log(`Highest role = ${highestRoleID}`);
  
    console.log(`User = ${userinfoget}`);
  
    const embed = new Discord.MessageEmbed()
     .setColor(message.guild.userinfoget.displayHexColor)
     .setAuthor(`${userinfoget.user.tag}`, userinfoget.user.displayAvatarURL())
     .addFields({ name: `User ping`, value: `&lt;@${userinfoget.id}&gt;` })
     .addFields({ name: `User ID`, value: `${userinfoget.id}` })
     .addFields(
      {
       name: 'Joined server',
       value: moment(userinfoget.joinedAt).format('LLLL'),
      } // or moment(userinfoget.joinedAt).format('DD/MM/YY, HH:mm:ss')
     )
     .addFields(
      {
       name: 'Joined Discord',
       value: moment(userinfoget.user.createdAt).format('LLLL'),
      } // or moment(userinfoget.createdAt).format('DD/MM/YY, HH:mm:ss')
     )
     .addFields({ name: 'Highest role', value: `&lt;@&amp;${highestRoleID}&gt;` })
     .addFields({
      name: 'Online Status',
      value: `${userinfoget.presence.status}`,
     });
    message.channel.send(embed);
   },
  };
  </code></pre>
  <p>but the bot crashes and the error is <code>Cannot read property 'displayHexColor' of undefined</code>. I also tried <code>.setColor(message.guild.userinfoget.displayHexColor)</code> as I saw on other posts, but that makes the embed the display color of the bot. What is the mistake I made? Thanks.</p>