badges

Hello, I'm doing a command where I pull the badges from the user's profile and I'm trying to pull nitro, but I can't pull it, the code is this const badgeEmojis = { NITRO: ':z_nitro:' }; const badges = user.flags ? user.flags.toArray() : []; const isNitro = user.premiumType && user.premiumType > 0; // Verifica se o usuário possui Nitro if (isNitro) badges.push('NITRO'); const badgesWithEmojis = badges.map(badge => badgeEmojis[badge] || badge).join(' '); message.reply(${badgesWithEmojis}); but I can't get it to return in any way, is the name "NITRO" correct? Is it spelled differently or something?
12 Replies
d.js toolkit
d.js toolkit3w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
haxz
haxzOP3w ago
v13.10.3
TÆMBØ
TÆMBØ3w ago
Not all badges have an associated user flag with them, and vice versa
haxz
haxzOP3w ago
Is there any way I can pull the nitro?
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
haxz
haxzOP3w ago
I didn't know about v13, but in this case I'm using oauth, I'll use this on the website
Amgelo
Amgelo3w ago
I mean, you are already inferring whether the user has nitro you aren't getting it from the flags it sounds like you copied that code without knowing what it does, because it does what you need
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
Amgelo
Amgelo3w ago
other ways people infer whether someone has nitro is by checking if they have an animated pfp or banner
haxz
haxzOP3w ago
I'm using this same code with more emblems, where it's working normally, the only problem is the nitro
Amgelo
Amgelo3w ago
but it's a matter of inferring and it can lead to false negatives, there's no direct way
haxz
haxzOP3w ago
humm Okay, I had an idea and I'll try to put it into practice. Thanks

Did you find this page helpful?