Search code examples
javascriptdiscorddiscord.js

How do I detect when a person joins a vc discord.js v13?


Hey whoever is reading this! I'm trying to make it so when someone joins a voice channel a variable goes up and when they leave it goes down, but when I try using the voiceStateUpdate event it doesn't do anything and then I put a console.log() into that event and it didn't log so I don't know if its the same in v13, and if there is something in the discord.js guid please respond with the link!


Solution

  • To be able to use voiceStateUpdate event, your client must declare the GUILD_VOICE_STATE intent in order to receive data about the voice state of the guild.

    When initialising your client:

    client = new Client({ intents: [..., Intents.FLAGS.GUILD_VOICE_STATES] });