I am trying to get all members without the bots, that works so far, but I can't access the variable outside of the function. Here's my code:
let real_members;
async function getRealMembers() {
// load the guild
interaction.guild.members.fetch().then(all_members => {
// remove bots from 'real' member count
real_members = all_members.sweep(member => !member.user.bot);
})}
await getRealMembers();
// call the function
console.log(real_members) // undefined