我搜索通过加入一个特定的其他语音通道来创建用于创建语音通道的漫游器,但是出现错误:
“ TypeError:无法读取未定义的属性'channel'”
bot.on('voiceStateUpdate', (oldMember, newMember, message) => {
let newUserChannel = newMember.voiceChannel
let oldUserChannel = oldMember.voiceChannel
if(oldUserChannel === undefined && newUserChannel !== undefined) {
var idVoiceChannel = newMember.voiceChannelID
console.log('Join')
if (idVoiceChannel === "605468426846800900") { //test
console.log('test')
bot.channel.createChannel('General', "voice").then(chan => {
chan.userLimit("5");
})
}else if(idVoiceChannel === "607223548620755073"){
console.log('testing 2')
}
} else if(newUserChannel === undefined){
// User leaves a voice channel
console.log('Leave');
}
})