Javascript 如何获取创建语音频道的id

Javascript 如何获取创建语音频道的id,javascript,discord,discord.js,bots,Javascript,Discord,Discord.js,Bots,我正在尝试获取ID以在discord js v12中创建语音频道 我得到一个未定义的数组 server.channels.create('helicopter', { type: "VOICE", parent: id_par }).then( result => { console.log(result.id)

我正在尝试获取ID以在discord js v12中创建语音频道

我得到一个未定义的数组

server.channels.create('helicopter', {
                                        type: "VOICE",
                                        parent: id_par
}).then( result => { console.log(result.id); voiceID.push(result.id)})
我还尝试:

const newChannel = server.channels.create('helicopter', {
    type: "VOICE",
    parent: id_par
});
let x = await newChannel.id;
这里x也是未定义的

这里还有:

server.channels.create('sky'{
输入:“语音”,
家长:身份证
});
id=server.channels.cache.find(channel=>channel.name=='sky'&&channel.type=='voice');
voiceID.push(id);
GuildChannelManager#create()
返回一个承诺,这意味着我们可以对其使用
。然后()
函数,并在bot完成此方法后直接获取通道对象。获得通道对象后,我们只需获取其ID并将其推入所需的数组

最终代码
GuildChannelManager#create()
返回一个承诺,这意味着我们可以在其上使用
。然后()
函数,并在bot完成此方法后直接获取通道对象。获得通道对象后,我们只需获取其ID并将其推入所需的数组

最终代码
guild.channels.create('name here', {
  type: 'voice',
  parent: id_par
}).then(channel => voiceID.push(channel.id))