B
B
BloodySamurai2021-10-01 20:17:51
Python
BloodySamurai, 2021-10-01 20:17:51

How to fix TeleBot error: “A request to the Telegram API was unsuccessful. Error code: 400. Description: Bad Request: file must be non-empty"?

Hello, sorry for a possibly stupid question (newbie in this field). I want to make it so that when a user sends a photo to the bot, it is sent instantly to another account, but the error described above pops up. Tell me what to change, I will be very grateful :)

import telebot
from io import BytesIO

@bot.message_handler(content_types=['photo'])
def send_text(message):
  bot.send_message(message.chat.id, 'Спасибо, аватарка отправилась админу на рассмотрение')
  x = message.photo[0]
  x = BytesIO()
  bot.send_photo(#Айди, x)

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