Reputation: 315
So basically my goal is to get a specific channel by it's name. I want to store it in a variable so I can delete it later.
let channel = //store specific channel in this variable using its name// ;
channel.delete();
And yes, I know I should use its ID because it's better, but in this case I can't use it's ID, I have to use its name.
Upvotes: 0
Views: 3319
Reputation: 6710
Use GuildChannelManager#find()
let channel = message.guild.channels.cache.find(channel => channel.name === 'channel-name-here');
channel.delete();
Upvotes: 0