title: Discord API | User Flags return badges
body: <p>I am using Node.JS and Discords OAuth2 API. When I return the <code>/users/@me</code> it returns the users object. Example:</p>
  <pre><code>{
    &quot;id&quot;: &quot;80351110224678912&quot;,
    &quot;username&quot;: &quot;Nelly&quot;,
    &quot;discriminator&quot;: &quot;1337&quot;,
    &quot;avatar&quot;: &quot;8342729096ea3675442027381ff50dfe&quot;,
    &quot;verified&quot;: true,
    &quot;email&quot;: &quot;nelly@discord.com&quot;,
    &quot;flags&quot;: 64,
    &quot;premium_type&quot;: 1,
    &quot;public_flags&quot;: 64
  }
  </code></pre>
  <p>Now I am after the <code>&quot;public_flags&quot;</code> integer which is &quot;64&quot; on Discords API reference each flag has a different Left shift operator from the example number before it would equal to (1 &lt;&lt; 6 : House Bravery), if a user has multiple badges it will add the total together. Flag IDs:</p>
  <pre><code>0   None
  1 &lt;&lt; 0  Discord Employee
  1 &lt;&lt; 1  Partnered Server Owner
  1 &lt;&lt; 2  HypeSquad Events
  1 &lt;&lt; 3  Bug Hunter Level 1
  1 &lt;&lt; 6  House Bravery
  1 &lt;&lt; 7  House Brilliance
  1 &lt;&lt; 8  House Balance
  1 &lt;&lt; 9  Early Supporter
  1 &lt;&lt; 10 Team User
  1 &lt;&lt; 12 System
  1 &lt;&lt; 14 Bug Hunter Level 2
  1 &lt;&lt; 16 Verified Bot
  1 &lt;&lt; 17 Early Verified Bot Developer
  </code></pre>
  <p>My question is how am I able to go through all math operations consisting the Flag ID's to then work out what badges a user has, or if there is an easier way to convert the number from the total resulting into what  badges the user has.
  Thanks :)</p>