Answers for "discord js get all members"

1

discord.js how to get all guilds

client.on("ready", () => {
    const Guilds = client.guilds.cache.map(guild => guild.id);
    console.log(Guilds);
});
Posted by: Guest on March-15-2021
0

How to hthe amount of users online in discordjs

// Get our server
const guild = bot.guilds.get('388093207575134208');

// Get our stats channels
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
Posted by: Guest on June-27-2020
2

discord.js get all members with role

//outputs the IDs of all members with the specified role as an array

// === discord.js v11 ===
message.guild.roles.get('ROLE-ID').members.map(m=>m.user.id);

// === discord.js v12 ===
message.guild.roles.cache.get('ROLE-ID').members.map(m=>m.user.id);
Posted by: Guest on October-20-2020

Code answers related to "discord js get all members"

Code answers related to "Javascript"

Browse Popular Code Answers by Language