P
P
ProooNoob2021-11-23 17:35:00
Python
ProooNoob, 2021-11-23 17:35:00

How to pull an image from a SQLite database and give it to the user?

I welcome everyone!
Tell me, is there any possibility in Telegram bot to do this:
1) The user enters a number corresponding to the number in the table
2) An image corresponding to the entered number is obtained from the SQLite database table.
3) This image or several images are sent to the user.

Tried like this, but it must be wrong)

def two_step(message):
    try:
        line_number = message.text
        photog = cursor.execute('SELECT photo FROM TableTable WHERE line_number=?', (line_number, )).fetchone() 
        bot.send_photo(message.chat.id, photo = photog)


Well, it seems that I managed to upload an image, I am attaching a screen from the database.
619cfaff8ccde817118209.jpeg

I would be glad for any help, otherwise I dug in)

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