title: Role specific commands from ID's fetched from a database
body: <p>So basically, I have gotten so far as to choose which commands should be used by whichever role, I have created some code, but my issue is that for whatever reason, if a user has any of the requirements for any of the commands, they are able to use all of the commands. I have been having issues with this for over a week. It needs to be based on the Role ID's, as the users have to set the allowed role in the database using the role's ID.</p>
  
  <p>This is for my Discord Bot, the database is Firebase, and I am running Discord.JS/Node.JS on VSC. I have tried formatting it so that the role filter comes first, but that got very messy. I don't believe the issue is referencing the role from the database, as I have logged the ID requested in the console, and it returns the correct string. Also, when a user has none of the allowed roles, they are not able to use the commands. </p>
  
  <pre class="lang-js prettyprint-override"><code>let msg_array = msg.content.split(" ");
      let command = msg_array[0];
      let args = msg_array.slice(1);
      let prefix = "t!"
      let inputtedCMD = msg.content.slice(prefix.length).split(" ")
      let cmd = bot.commands.get(inputtedCMD[0])
  
      let allowedR = null
  
      await firebaseDB.collection('roles').doc(msg.guild.id).get('role_id').then((r) =&gt; {
          if (!r.exists){
              msg.channel.send("You havn't chosen an allowed admin role.")
          } else {
              allowedR = `${r.data().role_id}`;
          }
      })
  
      let genRole = null
  
      await firebaseDB.collection('generalRoles').doc(msg.guild.id).get('generalRole_id').then((h) =&gt; {
          if (!h.exists){
              msg.channel.send("You havn't chosen an allowed general role.")
          } else {
              genRole = `${h.data().generalRole_id}`;
          }
      })
  
      let guildOwner = null
  
      await firebaseDB.collection('guilds').doc(msg.guild.id).get('generalRole_id').then((q) =&gt; {
          if (!q.exists){
              msg.channel.send("Cannot access guild owner data.")
          } else {
              guildOwner = `${q.data().guildOwnerID}`;
          }
      })
  
      let generalRole = msg.guild.roles.get(genRole)
      let adminRole = msg.guild.roles.get(allowedR)
  
  
      if (!command.startsWith(prefix)) return;
  
  
      if (inputtedCMD === "databaseReset") {
          if (guildOwner === msg.author.id || msg.author.id === "198590136684904448") {
              cmd.run(bot, msg, args, firebaseDB).then(() =&gt; {
                  console.log("[COMMAND] User w/ permission ran '" + inputtedCMD + "'")
                  return;
              })
          } else {
              const notAllowed = new Discord.RichEmbed()
                  .setAuthor("Hey, " + msg.author.tag, bot.user.displayAvatarURL)
                  .setDescription("**__No access__** \n *You need the required role to be able to use that command.*")
                  .setColor("#00A6ff")
                  .setTimestamp()
                  .setFooter("Ticket Bot | TBE")
              msg.channel.send(notAllowed)
              return;
          }
      }
  
      if (inputtedCMD === "set") {
          if (msg.member.roles.has(adminRole.id) || guildOwner === msg.author.id || msg.author.id === "198590136684904448") {
              cmd.run(bot, msg, args, firebaseDB).then(() =&gt; {
                  console.log("[COMMAND] User w/ permission ran '" + inputtedCMD + "'")
                  return;
              });
          } else {
              const notAllowed = new Discord.RichEmbed()
                  .setAuthor("Hey, " + msg.author.tag, bot.user.displayAvatarURL)
                  .setDescription("**__No access__** \n *You need the required role to be able to use that command.*")
                  .setColor("#00A6ff")
                  .setTimestamp()
                  .setFooter("Ticket Bot | TBE")
              msg.channel.send(notAllowed)
              return;
          }
      } 
  
      if (inputtedCMD === "config","help","invite","patchNotes","ticket") {
          if (msg.member.roles.has(adminRole.id) || msg.member.roles.has(generalRole.id) || guildOwner === msg.author.id || msg.author.id === "198590136684904448") {
              cmd.run(bot, msg, args, firebaseDB).then(() =&gt; {
                  console.log("[COMMAND] User w/ permission ran '" + inputtedCMD + "'")
                  return;
              }) 
          } else {
              const notAllowed = new Discord.RichEmbed()
                  .setAuthor("Hey, " + msg.author.tag, bot.user.displayAvatarURL)
                  .setDescription("**__No access__** \n *You need the required role to be able to use that command.*")
                  .setColor("#00A6ff")
                  .setTimestamp()
                  .setFooter("Ticket Bot | TBE")
              msg.channel.send(notAllowed)
              return;
          }  
      }
  </code></pre>
  
  <p>I expect that only the server owner and bot creator to be able to use databaseReset (bot creator ID is the ID included [which is me btw])</p>
  
  <p>Only the admin role of the server and the server owner and the bot creator should be allowed to use the "set" command.</p>
  
  <p>And everyone with the general bot use role should be allowed to use "config", "help", "invite", "patchNotes", and "ticket."</p>