K
K
kinton2018-03-07 00:15:15
Python
kinton, 2018-03-07 00:15:15

How to find out that a user has blocked your bot in telegram?

Hello!
I wrote a bot that uses a database, and once in a while runs through it and loads data for users. But if the user deleted the bot, he would still go over it in the database. Is there any way to know that the user has blocked the bot and remove it from the database?
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Bushmanov, 2018-03-11
@assanti

The code will return 403 status to sendMessage, and specifically the response body will be as follows:
I think you could check it yourself.

S
Stanislav Pugachev, 2018-03-07
@Stqs

I know that the bot will break off to deliver a message to the user who blocked the bot,
this fact can be used as a signal to clear the base,
if there is also a specific error raised, then finally fire

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question