+ 1

Sand message to all telegram bot users problem

I encountered a problem, sending in telegram bot does not work correctly. The chat user id of the bot is contained in the sqlite3 database. but when sending out a message is sent only to the first id in the database 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, 'Все') https://code.sololearn.com/c6kNMa8o4H0g/?ref=app

21st Apr 2020, 12:49 AM
Znikolazzz Shostak
Znikolazzz Shostak - avatar
1 Answer
0
Pro tip: Readability counts! one of Zen of Python rules... If you wan't to share your code. Please format it in proper way.
23rd Apr 2020, 6:58 AM
Piotr Szajer
Piotr Szajer - avatar