N
N
NaZaR_4iK2022-03-12 11:27:05
Python
NaZaR_4iK, 2022-03-12 11:27:05

Why can't the bot find a chat to send?

@dp.message_handler(commands=['sendall'])
async def sendall(message: types.Message):
  if message.chat.type == 'private':
      text = message.text[9:]
      users = db.get_users()
      for row in users:
        try:
          await bot.send_message(row[0], text )
          if int(row[1]) !=1:
            db.set_active(row[0], 1) 	
        except Exception as e:
   	        print(e)
        	db.set_active(row[0], 0)

      await bot.send_message(message.from_user.id,"Успешная рассылка")


Error:
Chat not found
Chat not found

I don't understand why such an error, messages were sent to the bot earlier.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question