我如何让我的漫游器创建/克隆另一个语音通道?
我希望我的机器人创建一个新的语音服务器,或者只是克隆另一个。 “ voic”是包含语音通道ID的var。
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.
回答如下:由于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);
}