Я хочу сохранить фото на свой компьютор полученное от юзера в телеграмм боте
Вот исходный код
@bot.message_handler(content_types=['photo'])
def start(message):
try:
chat_id = message.chat.id
file_info = bot.get_file(message.document.file_id)
downloaded_file = bot.download_file(file_info.file_path)
src = 'C:/Users/Timur/PycharmProjects/waltermark/documents/' + message.document.file_name;
with open(src, 'wb') as new_file:
new_file.write(downloaded_file)
bot.reply_to(message, "Пожалуй, я сохраню это")
except Exception as e:
bot.reply_to(message, e)
но выдаёт ошибку
'NoneType' object has no attribute 'file_id'