title: Is there a way to get channels by name? (Discord.js v12)
body: <p>I was creating a lock command where the channel name/id would be passed as the 1st argument. The command use case would be something like this: <code>.lock #[channel-name]/[channel_id]</code>. This works with a channel id, however, it returns <code>undefined</code> when I attempt to use a channel name instead (e.g <code>.lock #test</code>). Would there be a way to achieve this?</p>
  <pre class="lang-js prettyprint-override"><code>const channel =
   bot.channels.cache.find(
    (channel) =&gt; channel.name == `#${args.slice(0).join('-')}`
   ) || bot.channels.cache.get(args[0]);
  
  if (!channel) {
   console.log(channel);
   return message.reply('Please provide a channel name/id!');
  }
  
  if (!args[1]) {
   return message.reply('Please set the lock type!');
  }
  
  if (!channel.permissionsFor(message.guild.roles.everyone).has('VIEW_CHANNEL')) {
   const errorEmbed = new Discord.MessageEmbed()
    .setDescription(
     `❌ \`VIEW_CHANNEL\` for \`${channel.name}\` is already disabled.`
    )
    .setColor('RED');
   return message.channel.send(errorEmbed);
  }
  channel
   .updateOverwrite(channel.guild.roles.everyone, { VIEW_CHANNEL: false })
   .then(() =&gt; {
    const msgEmbed = new Discord.MessageEmbed()
     .setDescription(`✅ The channel\`${channel.name}\` has been locked.`)
     .setColor('GREEN');
    message.channel.send(msgEmbed);
   })
   .catch((error) =&gt; {
    console.log(error);
    const errorEmbed = new Discord.MessageEmbed()
     .setDescription(`❌ Unable to lock \`${channel.name}\`.`)
     .setColor('RED');
    message.channel.send(errorEmbed);
   });
  </code></pre>