<Member>.voice returns null

Heyhey, i've ran into an issue where whenever a member is connected to a channel when the bot starts or restarts, and then leaves, the old voicestate of that member will always be null. Any ideas on how to possbily prevent this?
6 Replies
d.js toolkit
d.js toolkit14mo 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.
treble/luna
treble/luna14mo ago
v14.11.0, node 18.8.0 there isnt really much code i can use other than
oldState.member.voice.channel
oldState.member.voice.channel
which returns null
Idris
Idris14mo ago
what about oldState.channel ? oldState.member.voice just returns oldState
treble/luna
treble/luna14mo ago
that returns the channel indeed, but the issue i face (i wrote this code yesterday evenying and i forgot how exactly i made it fucntion lmao) is that i need the member voicestate to determine whether the member that left the channel is the member that owned the channel (its one of those click to create voice channel things i'm making) wait i can just use oldState.member lmao
Idris
Idris14mo ago
yeah
treble/luna
treble/luna14mo ago
my brain is a diesel sometimes classic case of creating an issue and by explaining it you actually find out whats wrong lol