I have seen several posts on this topic, but they have not really helped me.
I want to check in a on_member_join
event if the avatar of the user is a default
or not. If a default
is the case, then the user should be banned, if not then not.
I had already worked out a code, but it bans the member even if the profile picture is not default:
@client.event
async def on_member_join(member):
has_avatar = client.check(lambda ctx: ctx.avatar_url != ctx.author.default_avatar_url) # Seen from another post
if has_avatar:
await member.ban(reason="Default avatar")
else:
channel1 = client.get_channel(ChannelID)
await channel1.send("No default avatar")
I also tried to compare the member.avatar
with a default
avatar but that did not work out.
What am I doing wrong?