J
J
James_Obry2021-05-29 15:53:15
Bots
James_Obry, 2021-05-29 15:53:15

How to save a photo sent to a telebot bot?

I need the bot to which the user sends a photo to save it in a folder and give it a name, please tell me how can this be done ???

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
UberPool, 2021-05-31
@UberPool

There is such a thing as documentation, because there are similar examples.

S
Studentka1996, 2021-06-02
@Studentka1996

Why can't you google?

file_info = bot.get_file(message.document.file_id)
downloaded_file = bot.download_file(file_info.file_path)
with open(путь к файлу, 'wb') as new_file:
            new_file.write(downloaded_file)
            bot.reply_to(message, f'Ваш  файл сохранен"')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question