Answer the question
In order to leave comments, you need to log in
Why is the mailing list not sent to all users?
Hello everyone, the question is, why is the mailing list not sent to users of the bot?
@dp.message_handler(content_types=['photo'])
async def checker(message: types.Message):
number = random.randint(1,999999)
text = message.caption
await message.photo[-1].download(f'{number}.jpg')
photo = open(f'{number}.jpg','rb')
users = cursor.execute("SELECT user FROM users").fetchall()
otpr = 0
nootpr = 0
print(users)
for user in users:
try:
await bot.send_photo(user[0],photo = photo,caption = text)
otpr = otpr + 1
time.sleep(0.3)
except Exception:
nootpr = nootpr + 1
pass
await bot.send_message(message.chat.id,text = f"<b>Рассылка завершена</b>\n\n<b>Отправлено: {otpr}\nНе отправлено: {nootpr}</b>",parse_mode = 'HTML')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question