title: Discord.js Get the member in a guild by username
body: <p>I was trying to get all the member's usernames on my discord server <br />
  However, it just gave back 8-9/25 members including 6 BOTs</p>
  <p>Here is my code</p>
  <pre><code>const list = client.guilds.cache.get(msg.guildId); 
  list.members.cache.each(r =&gt; {
     console.log(r.user.username)
  })
  </code></pre>
  <p>Besides that, I have also tried these ways</p>
  <pre><code>const list = client.guilds.cache.get(msg.guildId); 
     list.members.cache.array().forEach(r =&gt; {
        console.log(r.user.username)
  })
  </code></pre>
  <pre><code>const user = client.users.cache.find(u =&gt; u.username == '//The Given username')
  </code></pre>
  <pre><code>const user = msg.guild.roles.cache.get('//The Main Role in my Server')
               .members.map(m =&gt; m.user.username == '//The given username')
  </code></pre>
  <pre><code>let user = client.users.cache.get('username', '//The given username');
  </code></pre>
  <p>But sometimes it just returned my and my BOT's username or undefined.</p>
  <p>I'm trying to get all the members on the server and from that, I can find out the user has the same username with the given username, not tags or IDs</p>
  <p>I have turned on the <a href="https://i.stack.imgur.com/POhGl.png" rel="nofollow noreferrer">Gateway Intents</a> but it didn't help</p>
  <p>Please help with my project, I really need all the suggestions from you</p>