My Slash commands are registered and they come up in discord. Simplified version of my usage:
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
console.log(interaction.member.voice.channel);
interaction.reply('done');
});
When running this it will always give the ouput from when i started the bot. For example if I join a channel and then start the bot, it gives the correct output, but if i then leave the channel it gives me the same output. If I'm not in a channel when I start the bot, the output correctly is null but if i join a channel it will again still be null until i restart the bot. Has anybody had the same problem / is my thinking wrong or does someone know a fix?
This is not a problem with the slash commands functionality. You have to add the GUILD_VOICE_STATES intent to your client. This lets it detect updates to voice channels such as when you leave or join.