Unexpected behavior of client.on(Events.VoiceStateUpdate)
I need to check which users are in the channel and which are not after someone leaves. When I subscribe to Events.VoiceStateUpdate and try to console.log the users that are in the channel
it logs
Although I was expecting to see this
Can you please tell me why this is happening?
4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPMy discord.js is 14.15.3 and my node.js is v20.9.0
Can you log
<State>.constructor.name
for both oldState
and newState
?it is
The situation is like this, there is a bot and 1 user in the channel, when user leaves, I expected to see this
1020597576728334398 - is a bot id
Okay, thanks a lot, I thought newState.member was the bot itself