Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

117
Vistas
VoiceStates no actualiza discord.js

Estoy tratando de hacer un comando para mover todos los miembros en un canal de voz (en el que está el autor del comando) a otro (dado en el parámetro). Pero tengo un problema, VoiceState no se actualiza constantemente , conectar y cambiar de canal está bien, pero si me desconecto del canal de voz, el bot seguirá viendo mi VoiceState como si estuviera conectado.

 //The command file const Discord= require('discord.js'); const {SlashCommandBuilder} = require("@discordjs/builders"); module.exports = { data: new SlashCommandBuilder() .setName('move') .setDescription('Move all the members to a specific voice channel') .addChannelOption(option => option.setName('voicechannel') .setDescription('The voice channel to move everyone in') .setRequired(true)), async execute(interaction) { const author = interaction.member const voice = author.guild.voiceStates.cache console.log(voice.get(author.id)) console.log(interaction.options.get('voicechannel').channel.id) if (voice.get(author.id) == undefined || voice.get(author.id) == null){ await interaction.reply({content : 'You need to be in a voice channel first', ephemeral: true}) } else if (interaction.options.get('voicechannel').channel.id == voice.get(author.id).channelId) { await interaction.reply({content : 'Can\'t move to the same channel', ephemeral: true}) } else { await interaction.reply({content : 'ok', ephemeral: true}) ///TO IMPLEMENT CODE } }, };
 //my client constructor const client = new Discord.Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_VOICE_STATES] });
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Asegúrese de tener la intención GUILD_VOICE_STATES establecida en la construcción del Cliente.

 const client: Client = new discord.Client({ intents: 641, });

Tuve un problema similar, donde el estado de los canales de voz se estableció cuando se inició el bot, pero nunca se actualizó.

Usé esta calculadora de intenciones para contener fácilmente todas las intenciones.

Echa un vistazo al preset 'music bot' en particular (641).

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda