How can I check If a guild member has Discord Nitro?

Question:

How can I check with my Discord bot if a guild member has Discord Nitro and if it’s even possible?

I’m using discord.py with Python 3.8.

Answers:

.nitro


use user.profile().nitro instead.

You can do this passing the user argument as a discord.User object:

@Bot.command()
async def foo(ctx, user: discord.User): # Not discord.Member
    pass

If I understood well, the newest version of Discord.py uses User.Profile instead of User.profile().

Profile


Then, check also this, the API reference about the class discord.Profile.
Class discord.Profile has the attribute .premium with the alias .nitro. This will return a bool.

Impossible


You can’t do this with a bot.

Answered By: FLAK-ZOSO

Simple Answer: you can’t.


But in most cases, nitro users use animated profile pictures, boost a server or have a discriminator like #0001, #9999, #6969, or something.

You should know that users without nitro can have this discriminators too, but its very rare.

So you can check all of that.

@bot.command()
async def check_nitro(ctx):

    has_nitro = False

    # Check if the User boosts the guild

    if ctx.author.premium_since is not None:
        has_nitro = True

    # Check if the user has an animated profile picture

    if ctx.author.avatar_url is not None:
        if ctx.author.is_avatar_animated():
            has_nitro = True

    # check for discriminators like #0001 or #9999 or #6969
    # You should know that users without nitro can have this discriminators too, but its very rare.

    if ctx.author.discriminator in ("0001", "9999", "6969"):
        has_nitro = True

    if has_nitro is True:
        await ctx.reply("User has nitro!")
    else:
        await ctx.reply("User doesn't have nitro!")

Sources

Member Documentation

Answered By: Razzer