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.
can you help? I hope everything is clear
You have to replace guild.members.fetch()
with guild.fetchMember()
Also, the first argument of Channel.clone()
must be an Object
.
Instead of undefined
, just provide an empty Object
, as all options in the first parameter are optional.
channel.clone({}, true, true, "channel delete system")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.