Javascript Discord.js克隆类别中的特定语音频道;X";次数

Javascript Discord.js克隆类别中的特定语音频道;X";次数,javascript,discord.js,clone,Javascript,Discord.js,Clone,我正在为Discord上的教育服务器创建一个bot,很多时候我需要快速克隆语音频道,以便在小组中执行任务。 这些通道必须属于执行命令的同一类别,并保持与原始通道相同的权限。我还需要通过消息处理哪个通道被复制,以及复制了多少次 根据命令执行的位置,我设法检索了类别和其中包含的语音频道。bot返回一条包含语音频道列表的消息,并添加一个索引来识别这些频道,如下所示: 1-频道名称 2-频道名称 等等 我没有实现的是,仅仅通过指示通道的“索引”,然后是您想要克隆它的次数,它就会执行克隆功能 到目前为止,

我正在为Discord上的教育服务器创建一个bot,很多时候我需要快速克隆语音频道,以便在小组中执行任务。 这些通道必须属于执行命令的同一类别,并保持与原始通道相同的权限。我还需要通过消息处理哪个通道被复制,以及复制了多少次

根据命令执行的位置,我设法检索了类别和其中包含的语音频道。bot返回一条包含语音频道列表的消息,并添加一个索引来识别这些频道,如下所示:

1-频道名称
2-频道名称
等等

我没有实现的是,仅仅通过指示通道的“索引”,然后是您想要克隆它的次数,它就会执行克隆功能

到目前为止,我拥有以下内容(对不起,这是西班牙语,服务器来自阿根廷):

else if(命令=='canales'){
如果(!message.member.hasPermission('MANAGE_CHANNELS')){
message.channel.send('没有espacio的crear canales吊舱,只有管理层的hacerlo吊舱');
返回;
}
const filter=message.author;
const seccion=message.channel.parentID;
const voicenParent=wait message.guild.channels.cache.filter(c=>c.type==='voice'&&c.parentID===seccion);
const-canalesArray=voiceEnParent.map(u=>u.name);
const canalesIdArray=voiceEnParent.map(u=>u.id);
让startString='';
让pregunta='';
for(设i=0;i{
message.channel.waitingmessages(过滤器{
最高:1,
时间:15000,
错误:['time'],
})。然后(msg=>{
const index=msg.first();
如果(!isNaN(index.content)){
message.channel.send('**?Cuantas copias del canal querés hacer?**\n(Ingreáun valor numérico del 1 al 10')。然后(()=>{
message.channel.waitingmessages(过滤器{
最高:1,
时间:15000,
错误:['time'],
})。然后(异步emj=>{
const cantidad=emj.first();
if(isNaN(康蒂达内容)){
message.channel.send('La cantidad increcta,o no es un valor numérico');
返回;
}
否则{
message.channel.send(`Genial.Creéun total de${cantidad}copias del canal${canalesArray[(index.content-1)]}`);
设numInicio=0;
设intentos=0;
做{
message.guild.channel(canalesIdArray[index.content]).clone();
intentos=numInicio+=1;
}
while(intentos{
message.channel.send('Se acabóel tiempo');
});
})
.catch(错误=>{
message.channel.send(`Se acabóel tiempo.**错误:*${Error}`);
});
}
否则{
message.channel.send('El indice increado no existe,o no es un valor numérico.');
返回;
}
})
.catch(错误=>{
message.channel.send(错误);
});
});
message.delete({timeout:6000});
}
在我回复机器人发送的消息之前,一切正常:

message.channel.send(`**Que canal deseas duplicar?**responseéa este mensajeúnicamente con el número de indice del canal,según se indica:\n\n${pregunta})。然后(()=>{
当出现不和谐时,我回复该消息,我在控制台中收到此错误,bot崩溃

if(collect&&(等待this.filter(…args,this.collected))){
^
TypeError:Function.prototype.apply是在[object object]上调用的,它是一个对象而不是函数

有什么想法可以继续吗?

[SOLVED]

最后,我自己找到解决方案。如果有人需要,我在这里分享我的方法:

else if(命令=='canales'){
如果(!message.member.hasPermission('MANAGE_CHANNELS')){
message.channel.send('没有espacio的crear canales吊舱,只有管理层的hacerlo吊舱');
返回;
}
const filter=m=>m.author.id==message.author.id;
const seccion=message.channel.parentID;
const voicenParent=wait message.guild.channels.cache.filter(c=>c.type==='voice'&&c.parentID