我希望我的机器人创建一个新的语音服务器,或者只是克隆另一个。 “ voic”是包含语音通道ID的变种。
voic.voiceChannel.clone(undefined, true, false, 'Needed a clone')
// discord example
.then(clone => console.log(`Cloned ${channel.name} to make a channel called ${clone.name}`))
.catch(console.error);
}
TypeError: Cannot read property 'clone' of undefined.
答案 0 :(得分:0)
由于voic
本身就是一个ID,因此您需要使用其ID来获取频道。您可以使用bot.channels.get()
来检索频道。
var bot = new Discord.Client();
bot.on('ready', () => {
bot.channels.get(voic).clone(undefined, true, false, 'Needed a clone')
.then(clone => console.log(`Cloned ${channel.name} to make a channel called ${clone.name}`))
.catch(console.error);
}