title: Discord Bot error occurs when it has no permissions
body: <p>I'm trying to make it so my bot can just check if one permission is met, and I've tried a method where surrounding the permission with <code>['Permission']</code> and it works out so far, the problem is that if the permissions aren't met, then the bot gives off an error.</p>
  
  <pre><code>TypeError: Cannot read property 'edit' of undefined
  </code></pre>
  
  <p>The bot still works fine, but it should give off a message like "I don't have permissions" (Which I added), instead it just gives off the </p>
  
  <pre><code>An error occurred while running the command: TypeError: Cannot read property 'edit' of undefined
  You shouldn't ever receive an error like this.
  Please contact the bot owner.
  </code></pre>
  
  <p>error.</p>
  
  <p>I've tried changing the placement of the permissions code, and I've tried finding some other posts about this, but it was just normal javascript, not discord.js.</p>
  
  <p>I've used the method where it's <code>hasPermission("MANAGE_WEBHOOKS", "ADMINISTRATOR")</code> but it checks if BOTH permissions are met, for me it's ok if only ONE permission is met, and I don't want the bot to require if itself and the message author has both of the permissions.</p>
  
  <pre><code>const Discord = require('discord.js');
  const commando = require('discord.js-commando');
  
  class pingy2 extends commando.Command 
  {
      constructor(client) {
          super(client, {
              name: 'pinghook2',
              group: 'help',
              memberName: 'pinghook2',
              description: 'This is where you can set the pinghook.',
              aliases: ['ph2'],
          })
      }
  async run(message, args){
  if(message.member.guild.me.hasPermission(["MANAGE_WEBHOOKS"], ["ADMINISTRATOR"]))
  return message.channel.send("I don't have the permissions to make webhooks, please contact an admin or change my permissions!")
  if (!message.member.hasPermission(["MANAGE_WEBHOOKS"], ["ADMINISTRATOR"])) 
  return message.channel.send("You need to be an admin or webhook manager to use this command.")
  
  const avatar = `https://cdn.discordapp.com/attachments/515307677656678420/557050444954992673/Generic5.png`;
  const name2 = "PingBot";
  const hook = await message.channel.createWebhook(name2, avatar).catch(error =&gt; console.log(error))
  await hook.edit(name2, avatar).catch(error =&gt; console.log(error))
  message.channel.send("Your webhook is now created! You can delete it at any time and can be re-added by using this command! You can also edit the webhook's name or avatar.")
  
  setInterval(() =&gt; {
      hook.send("success!")
  }, 1200);
  
  }};
  module.exports = pingy2;
  </code></pre>
  
  <p>I expect the bot to create a webhook when the command is sent in chat, and if the bot finds that only one permission is met, it still continues the command.</p>
  
  <p>What actually happened was that the bot does create the webhook, without any errors, but when you strip the bot of the <code>ADMINISTRATOR</code> and <code>MANAGE_WEBHOOKS</code> permission, it gives off the "An error occurred while running the command." error, not the error put into the command's code.</p>