Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda