Reputation: 5
I am creating a bot that sets up a server when !setup
is run. I have successfully created the channels I need but I do not know how to delete the default text and voice channels along with their respective categories.
I have not tried anything yet.
I would like the default channels to be deleted once the other channels have been created.
Upvotes: 0
Views: 104
Reputation: 5623
A simple option would be to find the channels in the guild which have been created at the same time of the guild, then iterate through and delete each.
Example:
const defaultChannels = message.guild.channels.filter(c => c.createdTimestamp === message.guild.createdTimestamp);
defaultChannels.forEach(channel => {
channel.delete()
.catch(console.error);
});
Upvotes: 1