Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

543
Views
Discord API - Get user's badges using public_flags

I'm using javascript and i'm looking for how to get a list of flags (from public_flags) that a user has as an example:

[
  "House Bravery",
  "Partnered Server Owner",
  "Early Verified Bot Developer"
]

I'm not using discord.js

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

This works if you're trying to get them from a user object -

await user.fetchFlags().toArray() // would return an array as you require
about 4 years ago · Juan Pablo Isaza Report

0

I found out how to achieve it with vanilla javascript:

var badges = [];
var flags = response.public_flags

flags = response.public_flags

if ((flags & badges2.Discord_Employee) == badges2.Discord_Employee) {
    badges.push("Discord Employee")
}

if ((flags & badges2.Early_Supporter) == badges2.Early_Supporter) {
    badges.push("Early Supporter")
}

if ((flags & badges2.House_Balance) == badges2.House_Balance) {
    badges.push("House Balance")
}

if ((flags & badges2.House_Brilliance) == badges2.House_Brilliance) {
    badges.push("House Brilliance")
}

if ((flags & badges2.House_Bravery) == badges2.House_Bravery) {
    badges.push("House Bravery")
}

if ((flags & badges2.Bug_Hunter_Level_1) == badges2.Bug_Hunter_Level_1) {
    badges.push("Bug Hunter LVL.1")
}

if ((flags & badges2.Bug_Hunter_Level_2) == badges2.Bug_Hunter_Level_2) {
    badges.push("Bug Hunter LVL.2")
}

if ((flags & badges2.Early_Verified_Bot_Developer) == badges2.Early_Verified_Bot_Developer) {
    badges.push("Verified Bot Dev")
}

if ((flags & badges2.HypeSquad_Events) == badges2.HypeSquad_Events) {
    badges.push("HypeSquad Events")
}

if ((flags & badges2.Partnered_Server_Owner) == badges2.Partnered_Server_Owner) {
    badges.push("Partnered Server Owner")
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!