I am trying to create a serverinfo command for my Discord.js Bot. I am trying to get the Discord Server User Count separate from the Server's Bot Count. I have been told to use the .filter
but I don't understand how to filter the bot count from the user count.
Well from guild.members.cache
you'll get a Collection with all the members (users and bots). With .filter
you can "exclude" items of a collection if they don't match something. For example:
guild.members.cache.filter(member => !member.user.bot).size;
Should return the number of members that aren't bots on guild
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With