Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
Why is my Discord bot only fetching online users?

I have created a simple Discord bot in Node.js. I've enabled GUILD_MEMBERS and GUILD_PRESENCES intents, yet when I try and fetch all members, it is only returning online members.

import { Client } from "discord.js";
const client = new Client({intents: ["GUILDS","GUILD_MESSAGES","GUILD_MEMBERS","GUILD_MESSAGE_REACTIONS", "GUILD_PRESENCES"]});

const guildId = '<guild_id>';

client.on("ready", async () => {
    console.log(`logged in as ${client.user.tag}`);
    const guild = await client.guilds.fetch(guildId);
    const members = await guild.members.fetch();
    
    members.forEach(member => console.log(member.displayName);
});

Output, with my main account online and my alt offline:

logged in as bot1#tagg
mainaccount
bot1

Output, with my main account online and my alt online:

logged in as bot1#tagg
mainaccount
altaccount
bot1

And when I change the log to console.log(member.presence.status), the output is

logged in as bot1#tagg
online
online
online

As you can see, I am fetching all members and logging their display names. I currently have my main account, my alt account and the bot account in the server, but it only logs the names of the members that are currently online. Why is this, and how can I fix it?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!