I have the following issue: I'm using Role.id.client to check if the user has the following role. It does throw the error on the bottom, but the term should be correct. Can somebody help me?
client.on("voiceStateUpdate", (oldState, newState) => {
if(newState.channelId === `937722527894089806` && Role.id.client ==! `938113190041124885`) {
The error code:
[nodemon] starting `node src/index.js`
Ready! Logged in as Rainbow Six | DE Test Bot#0280!
C:\Users\emre2\Desktop\Coding\Visualstudiodateien\src\index.js:56
if(Role.id.client ==! `938113190041124885`) { //Warten
^
TypeError: Cannot read properties of undefined (reading 'client')
at Client.<anonymous> (C:\Users\emre2\Desktop\Coding\Visualstudiodateien\src\index.js:56:16)
at Client.emit (node:events:390:28)
at VoiceStateUpdate.handle (C:\Users\emre2\Desktop\Coding\Visualstudiodateien\node_modules\discord.js\src\client\actions\VoiceStateUpdate.js:38:14)
at Object.module.exports [as VOICE_STATE_UPDATE] (C:\Users\emre2\Desktop\Coding\Visualstudiodateien\node_modules\discord.js\src\client\websocket\handlers\VOICE_STATE_UPDATE.js:4:35)
at WebSocketManager.handlePacket (C:\Users\emre2\Desktop\Coding\Visualstudiodateien\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)
at WebSocketShard.onPacket (C:\Users\emre2\Desktop\Coding\Visualstudiodateien\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\emre2\Desktop\Coding\Visualstudiodateien\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\emre2\Desktop\Coding\Visualstudiodateien\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:390:28)
at Receiver.receiverOnMessage (C:\Users\emre2\Desktop\Coding\Visualstudiodateien\node_modules\ws\lib\websocket.js:1098:20)
[nodemon] app crashed - waiting for file changes before starting...