Add an event listener to variable change

I'm trying to create an event for when <VoiceChannel>.members.size < 2 (when my bot is the only one in the VC). I have found some... slightly intimidating stack overflow answers here but was wondering if anyone else had an easier solution? Only reason I'm asking is this is that I notice many bots will leave a voice channel when they are the only person in it, hence 24/7 mode.
Stack Overflow
Listening for variable changes in JavaScript
Is it possible to have an event in JS that fires when the value of a certain variable changes? JQuery is accepted.
2 Replies
d.js docs
d.js docs2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Oscar
Oscar2y ago
Nevermind, didn't know that voiceStateUpdate existed lol