M
M
mishennka2020-07-06 15:33:29
Python
mishennka, 2020-07-06 15:33:29

How to push a photo into a telegram bot variable and use it in the future?

Problem - I'm creating a telegram bot for the marketplace. That is, the user fills out an application, after which his application is sent to the tg channel. It should also include photographs. But not the point. Text variables, by city type, name, etc. I did, but I can’t put a photo in any way, I’m too young in this matter. I am programming in Python, I use pyTelegramBotAPI, please help, I will answer all questions.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Barbolin, 2020-07-06
@mishennka

Have you looked at the official documentation?
https://pypi.org/project/pyTelegramBotAPI/

# All send_xyz functions which can take a file as an argument, can also take a file_id instead of a file.
# sendPhoto
photo = open('/tmp/photo.png', 'rb')
tb.send_photo(chat_id, photo)
tb.send_photo(chat_id, "FILEID")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question