Answer the question
In order to leave comments, you need to log in
Why is the bot not sending messages?
When I try to send, this pops up:
telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 403 Forbidden. Response body:
[b'{"ok":false,"error_code":403,"description":"Forbidden: user is deactivated"}']
def broadcast(chat_id):
while True:
if getBotUsers() != ["ПУСТО"]:
for i in getBotUsers():
bot.send_message(i, text)
sleep(0.1)
bot.send_message(chat_id, "Рассылка была завершена !")
else:
bot.send_message(chat_id, "Пользователи не были обнаружены !")
Answer the question
In order to leave comments, you need to log in
One of the users to whom the mailing is carried out added the bot to the blacklist:
https://core.telegram.org/api/errors#403-forbidden
To prevent the mailing list from dying due to one error, you can wrap it in try/except:
for i in getBotUsers():
try:
bot.send_message(i, text)
except:
pass
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question