P
P
popoff032018-11-26 15:07:16
Python
popoff03, 2018-11-26 15:07:16

You need to send a photo to the user of the bot. How to do it right?

I am writing a bot and I need to send a photo. I looked at how to upload a photo and send it by file_id. Those. I upload a photo to the bot and in the browser I get a file_id (api.telegram.org/bot/getupdates. Yes, stupid. I'm a newbie. Especially now it doesn't send me a photo ID at all). You need to upload a lot of photos. How else can I send a photo? just from the folder with the bot? Or maybe you can store photos in the database (maybe I wrote stupidity)? Who can tell? Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
spikejke, 2018-11-26
@popoff03

Hello, I advise - https://github.com/eternnoir/pyTelegramBotAPI
the simplest example:

# sendPhoto
photo = open('/tmp/photo.png', 'rb')
tb.send_photo(chat_id, photo)

P
popoff03, 2018-11-26
@popoff03

Is it necessary to specify the entire path to the file? Like C:/users/.../papka/photo.jpg?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question