Estoy tratando de verificar si el usuario que inició un comando está actualmente en un canal de voz, y mientras ejecuto el bot, mi código funciona y obtengo la información del canal de voz si luego DEJO el canal y reinicio el comando ¿Recibo la misma información del canal de voz como si estuviera almacenada en caché? La única forma de recibir información actualizada es reiniciar mi bot por completo.
export const interactionListener = async (interaction, client) => { if (!interaction.isCommand()) return; const { commandName } = interaction; switch (commandName) { case 'play': let user = await interaction.member.fetch(); let channel = await user.voice.channel; if (!channel) { interaction.reply('you are not in a voice channel'); } else { interaction.channel.send('do something else'); } } };y ese código se está ejecutando en una interacción Crear aquí
client.on('interactionCreate', async (interaction) => { interactionListener(interaction, client); });CORREGIDO: necesitaba otra intención
Las intenciones anteriores fueron:
const client = new Client({ intents: [ Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_PRESENCES, ], });Las NUEVAS intenciones son:
const client = new Client({ intents: [ Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_PRESENCES, Intents.FLAGS.GUILD_VOICE_STATES, ], });estaba perdido
Intents.FLAGS.GUILD_VOICE_STATES