N
N
Nikolai Neizvestny2020-04-20 21:41:13
Python
Nikolai Neizvestny, 2020-04-20 21:41:13

Why is sending messages to bot users not working?

def answer(bot, update):
    global mail, city, cit, rayon,lol, tovari, lol1, tovar
    message = update.message
    if (message.chat.id in constants.admins) and message.text == 'Рассылка':
        mail = True
        bot.send_message(message.chat.id, 'Напишите сообщение!')
    elif mail == True:
        mail = False
        text = base_work.all_id()
        bot.send_message(message.chat.id, 'В течении 3 секунд, отправиться всем пользователям!')
        for i in text:
            try:
                bot.forward_message(i, message.chat.id, disable_notification=True, message_id=message.message_id)
            except:
                pass
        bot.send_message(message.chat.id, 'Все')

what's wrong? no errors, etc., it doesn’t crash, but it doesn’t send,
I’m very weak in all this, don’t scold

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Neizvestny, 2020-04-21
@NHide

I figured out the problem, it turned out that there were people in the database table who did not contact the bot (they were added before I installed the bot), deleted them from the database and everything worked.
Problem number two
, messages are only sent to the first ID in the table and don't go any further. How to be?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question