title: How to check how many people have a role using discord.js?
body: <p>I want to see how many members have a certain role in my server. To do so I am using the code:</p>
  <pre><code>const bots = guild.roles.cache.find(role =&gt; role.name == &quot;Bots&quot;);
  console.log(bots.members.cache.size);
  </code></pre>
  <p>which was the solution provided in this question: <a href="https://stackoverflow.com/questions/63538208/how-can-i-check-how-many-people-have-a-role-in-a-specific-discord-server">How can I check how many people have a role in a specific discord server?</a></p>
  <p>However, I keep getting this error: <code>TypeError: Cannot read property 'size' of undefined</code>.</p>