X
X
xxxfdd2021-12-21 18:40:08
Python
xxxfdd, 2021-12-21 18:40:08

How to make the user be able to fill in the database through the telegram bot?

I have a bot and when a person clicks on the button to fill in the database, he will get a message, write a name and this message should be written to the database, but I have a problem when a person clicks to fill in the database and then sends the name This name does not enter the condition

if message.text == 'Пополнить базу данных':
        import psycopg2

        con = psycopg2.connect(
            host='localhost',
            database='Man_kaban',
            user='postgres',
            password='42661902',
            port=5432
        )
        curr = con.cursor()
       далее идет заись в буз данных слово но это 2 слово не доходит до сюда

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Krostelev, 2021-12-22
@twistfire92

What library are you using? If PyTelegramBotAPI (telebot) then use register_next_step_handler
If aiogram then use state machine (FSM)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question