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

90
Visualizações
Channel members are not getting updated

I'm using discord.js v13.

I want to disconnect all members from a voice channel. Using interaction.guild.channels.fetch(), I'm able to get voice channels and the members' information.

But when I switch the voice channel, the data is still wrong because it's not updating.

This is my code:

client.on('interactionCreate', async interaction => {
  if (!interaction.isCommand()) return;

  const { commandName } = interaction;

  switch (commandName) {
    case 'channels':
      const channelInput = interaction.options.getString('channelname');
      const channelExist = (await interaction.guild.channels.fetch()).find(channel => {
        return channel.name == channelInput && channel.isVoice()
      })
      
      if (!channelExist) {
        await interaction.reply('no voice channel');
        break;
      }
      console.log(channelExist.members)
      console.log('===========')

      break;
  }
});

How can I fix this problem?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

To receive updates from voice channels on who is joining and leaving which channels you need to supply you client with the GUILD_VOICE_STATES intent. That will allow your data to update.

about 4 years ago · Juan Pablo Isaza 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