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

290
Visualizações
Fetching Discord Channel Members

I am attempting to fetch all the members of a certain Discord voice channel using discord.js

I have a function trying to do this right now. It takes in an interaction, that is given when a user runs a slash command on Discord. The options parameter is simply the channel they pass in to the command.

This is what running the command looks like

const execute = async (interaction, options) => {
  if (interaction.member.permissions.has(Permissions.FLAGS.MANAGE_GUILD)) {
    await interaction.guild.members.fetch();
    await interaction.deferReply({ ephemeral: true });
    const channelInput = options.getChannel('channel');
    const channel = await interaction.member.guild.channels.fetch(channelInput.id);
    const members = channel.members.map(member => member.id);
    console.log(members); // [ '143100912687251456', '143100912687251622' ]
  }
}

The issue is that it does not update properly if the user changes channels. If I restart the bot, and run the command, it executes perfectly. But if I were to change to another voice channel, it still thinks I am in the old one and not the new one.

This is probably because it is fetching some sort of cache. Does anyone know how to fetch their API directly instead of a local cache that isn't updating?

almost 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Add GuildVoiceStates Intent

    intents: [
        GatewayIntentBits.GuildVoiceStates,
    ],
almost 4 years ago · Santiago Trujillo Relatório
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