title: Check discord.js Bot Permission
body: <p>Here as you see the code run at starting bot and get user invites from each server, and as you know need Administrator role but for example this bot is on 10 servers and one of these server  turn off the ADMINISTRATOR role from bot and my bot got error and got <code>Missing Access</code> and then crash and just close I mean you must press any key</p>
  <p>Here I want to check server perm I mean for one server and if the bot in the server didn't have role ignore it and not crash</p>
  <pre class="lang-js prettyprint-override"><code>module.exports = (client) =&gt; {
    const invites = {} // { guildId: { memberId: count } }
    const db = require(&quot;quick.db&quot;)
    const getInviteCounts = async (message,guild) =&gt; {
      return await new Promise((resolve) =&gt; {
  
        guild.fetchInvites().then((invites) =&gt; {
  
          const inviteCounter = {} // { memberId: count }
  
          invites.forEach((invite) =&gt; {
            const { uses, inviter } = invite
            const { username, discriminator } = inviter
  
            const name = `${username}#${discriminator}`
  
            inviteCounter[name] = (inviteCounter[name] || 0) + uses
          })
  
          resolve(inviteCounter)
  
        })
  
      })
    }
  </code></pre>