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
- 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 staffv13.10.3
Not all badges have an associated user flag with them, and vice versa
Is there any way I can pull the nitro?
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
I didn't know about v13, but in this case I'm using oauth, I'll use this on the website
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•3w ago
Message Not Public
Sign In & Join Server To View
other ways people infer whether someone has nitro is by checking if they have an animated pfp or banner
I'm using this same code with more emblems, where it's working normally, the only problem is the nitro
but it's a matter of inferring and it can lead to false negatives, there's no direct way
humm
Okay, I had an idea and I'll try to put it into practice. Thanks