Skip to content Skip to sidebar Skip to footer

Deleting Single Channel/all Channels Does Not Work

I'm creating a bot that manages a server to get used to JavaScript and the Discord.js library. I tried deleting a channel using this code, but it didn't work. guild.channel.delete(

Solution 1:

If you want your bot to delete every single channel in a guild, do this:

guild.channels.forEach(c => c.delete());

Your attempt failed to work since channel isn't a property of the Guild Class. So what I'm doing is accessing the channels collection of the Guild Class, which contains every single Channel of that Guild. Then we can iterate over each channel and use the delete method, which is part of every GuildChannel Object.

Post a Comment for "Deleting Single Channel/all Channels Does Not Work"