当有人走进一个房间时,我希望他们把它扔到另一个房间
这是代码
client.on("voiceStateUpdate", function(oldMember, newMember){
let room = client.channels.cache.get('586962325240676370');
let newVoice = newMember.voice.channelID
if (newVoice == room){
let channelgit = client.channels.cache.get('757403475129794600')
member.voice.setChannel(channelgit);
}
});
我收到这个错误
C:\Users\user\Desktop\proton mdul\index.js:44
let newVoice = newMember.voice.channelID
^
TypeError: Cannot read property 'channelID' of undefined
at Client.<anonymous> (C:\Users\user\Desktop\proton mdul\index.js:44:37)
at Client.emit (events.js:311:20)
at VoiceStateUpdate.handle (C:\Users\user\Desktop\proton mdul\node_modules\discord.js\src\client\actions\VoiceStateUpdate.js:40:14)
at Object.module.exports [as VOICE_STATE_UPDATE] (C:\Users\user\Desktop\proton mdul\node_modules\discord.js\src\client\websocket\handlers\VOICE_STATE_UPDATE.js:4:35)
at WebSocketManager.handlePacket (C:\Users\user\Desktop\proton mdul\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\user\Desktop\proton mdul\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\user\Desktop\proton mdul\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\user\Desktop\proton mdul\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:311:20)
at Receiver.receiverOnMessage (C:\Users\user\Desktop\proton mdul\node_modules\ws\lib\websocket.js:797:20)
子衿沉夜
相关分类