O
O
old_stalin2021-05-08 19:03:15
Python
old_stalin, 2021-05-08 19:03:15

How to tell if a user is banned or logged out?

There is a function in disord.py:

async def on_member_remove(self, member):
    ...

To remove a user from the database, I need to distinguish between a banned user or he left himself, so here's how to track it and how to get access to banned users in general.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Nevzorov, 2021-05-08
@old_stalin

Check if the user is on the banned list.

if ban_entry := discord.utils.get(await member.guild.bans(), user__id=member.id):
    print(member, "banned, reason: ", ban_entry.reason)

S
soremix, 2021-05-08
@SoreMix

member.is_blocked()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question