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

252
Visualizações
Discordia.js | ¿Cómo hacer que los miembros estén actualmente conectados a un canal de voz?

Estoy tratando de obtener los miembros que actualmente están conectados a un canal de voz específico. Con algunas propiedades pude obtenerlos, pero el problema que encontré fue que los miembros que aparecen en la lista no son los que están conectados actualmente, sino los que estaban conectados al canal de voz cuando el bot comenzó a ejecutarse.

Este es mi código (está acortado pero copiado):

 const {Client, Intents} = require('discord.js') const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_PRESENCES, Intents.FLAGS.GUILD_MEMBERS] }) client.on('messageCreate', messagesHandler) function messagesHandler (msg) { if (msg.author.bot) return false; console.log(`Msg received: ${msg.content}`) if (msg.content.startsWith('/')) { const msgArr = msg.content.split(' ') switch (msgArr[0]) { case '/list': listCommand(msg, msgArr) break } } } async function listCommand (msg, msgArr) { if(!msgArr[1]) { const voiceChannel = await getChannel(msg, 'Voice1', true).fetch() if (!voiceChannel) { msg.channel.send('ERROR: Voice1 channel not found') } else { await getCurrentChannelMembers(msg, voiceChannel) } } } function getChannel(msg, channel, voiceChannel = false) { return msg.guild.channels.cache.find(c => c.name === channel && (!voiceChannel || c.isVoice())) } async function getCurrentChannelMembers (msg, channel) { const fetchedChannel = await channel.fetch(true) const members = fetchedChannel.members console.log('Members: ', members) }

¡Cualquier ayuda sería apreciada!

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

0

Su bot necesita la intención GUILD_VOICE_STATES

 const client = new Client({ intents: [ Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_PRESENCES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_VOICE_STATES ] })
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