voiceState is undefined

client.on('voiceStateUpdate', (oldState, newState) => {
voiceClient.startListener(oldState, newState);
console.log(voiceClient.getUserData(client.guilds.cache.get(guildID).members.cache.get(newState.id)))
})
client.on('voiceStateUpdate', (oldState, newState) => {
voiceClient.startListener(oldState, newState);
console.log(voiceClient.getUserData(client.guilds.cache.get(guildID).members.cache.get(newState.id)))
})
Inside of the console.log() I am trying to log the user data of the state's user, but as I try and do that, I get an error saying Can't read properties of undefined reading 'id', yet, When I try and log the voiceState it logs fine. Am I doing something wrong here?
3 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
DanielBA
DanielBAOP3y ago
It does work when I comment the line with that function. startListener is a function from djs-voice.
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server