discord js get all members code example
Example 1: How to hthe amount of users online in discordjs
const guild = bot.guilds.get('388093207575134208');
const totalUsers = bot.channels.get('470358845751951361');
const onlineUsers = bot.channels.get('470366354222874665');
const codeMonkeys = bot.channels.get('470358906225295391');
var userCount = guild.memberCount;
var onlineCount = guild.members.filter(m => m.presence.status === 'online').size
Example 2: discord.js get all members with role
message.guild.roles.get('ROLE-ID').members.map(m=>m.user.id);
message.guild.roles.cache.get('ROLE-ID').members.map(m=>m.user.id);