Skip to content Skip to sidebar Skip to footer

How Do I Check For A Default Profile Pic With Discord.py?

I’m currently trying to find a way to block commands on my bot if the sender has a default profile picture, how would I code this?

Solution 1:

I believe that this is equivalent to checking if the avatar_url equals default_avatar_url for the author. We can package that in a check pretty easily:

has_avatar = commands.check(lambda ctx: ctx.avatar_url != ctx.author.default_avatar_url)

@has_avatar
@bot.command()
def some_command(ctx):
    await cts.send("You have set your avatar")

Post a Comment for "How Do I Check For A Default Profile Pic With Discord.py?"