Answer the question
In order to leave comments, you need to log in
How to find out which user blocked the bot?
There is a script for sending letters, I can prodynamize the user who blocked the bot, but how to find out which user with the user_id from the file blocked it?
try:
text = message.text
handle = open("Users/chatid_list.txt", "r")
for line in handle:
bot.send_message(line, text)
handle.close()
except:
bot.send_message(message.chat.id, 'Заблокировали бота - ')
Answer the question
In order to leave comments, you need to log in
Well, an exception happens when sending a specific id - so display this id.
By the way, in except it is better to specify a specific type of exception. Because a ConnectionError may happen due to a downed network or a Telegram failure - and the bot will decide that everyone has blocked it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question