简体   繁体   English

V11版本不匹配

[英]V11 version mismatch

client.on("channelDelete", async channel => {
  let channelg = await db.fetch(`channel_${channel.guild.id}`);
    if (channelg == "on") {
  const logs = await channel.guild.fetchAuditLogs({ type: 'CHANNEL_DELETE' }).then(audit => audit.entries.first())
  const deleter = await channel.guild.members.fetch(logs.executor.id);
  if(deleter.id == channel.guild.owner.user.id) return;
  channel.clone(undefined, true, true, "channel delete system").then(async klon => {
    await klon.setParent(channel.parent);
    await klon.setPosition(channel.position);
        channel.guild.owner.send(`channel: **${channel.name}** channel it occurred again.`)
    console.log('correct')
  })
  }

})

allows you to create a channel back when it is deleted允许您在删除时重新创建频道

how to make discord.js V11 version compatible, V12 was prepared for release.如何兼容discord.js V11版本,准备发布V12。

can you help?你能帮我吗? I hope everything is clear我希望一切都清楚

You have to replace guild.members.fetch() with guild.fetchMember()你必须用guild.members.fetch() guild.fetchMember()


Also, the first argument of Channel.clone() must be an Object .此外, Channel.clone Channel.clone()的第一个参数必须是Object

Instead of undefined , just provide an empty Object , as all options in the first parameter are optional.而不是undefined ,只需提供一个空的Object ,因为第一个参数中的所有选项都是可选的。

channel.clone({}, true, true, "channel delete system")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM