share
Stack OverflowHow can i check that user has blocked a bot? | Discord.py
[-4] [1] Astraeus
[2022-06-13 13:47:30]
[ python discord discord.py ]
[ https://stackoverflow.com/questions/72603971/how-can-i-check-that-user-has-blocked-a-bot-discord-py ]

Is it possible to check that the message author has blocked my bot? I want to check if the user is blocking the bot and if so, then delete his message.

I feel this question should be more gauged towards looking through the developer documentation for Discord and using logic to follow how to solve your problem. - Aidan Donnelly
(1) Hey Astraeus, welcome to Stack Overflow! Please edit your post to narrow it down to a specific programming question. Stack Overflow is not a code-writing service - you should give your problem a try and see what you're struggling with. - TheFungusAmongUs
[+1] [2022-06-13 14:19:13] R C N

The Discord API does not have an endpoint to check if a user has blocked you, although there is one way (not very accurate) to check it.

You can send a message (In DM's) to that user and catch any exceptions, if something is raised there are two options. the first one is if the user closed his DM's. and the second one is could be if the user blocked the bot.

So It's kind of a % 50/50 but most of the users (that I at least know) do not close their's DM's


1