Answer the question
In order to leave comments, you need to log in
How to write python requests of Telegram bot to mysql DB?
Hello.
I'm just learning, I wrote a bot in python.
Since n-people have access to it, the question arose of how to record all the requests that come to him in the mysql database, so that you can see who and when what command he sent and what he received in response.
The bot is running on my PC.
I will be very grateful.
Answer the question
In order to leave comments, you need to log in
My idea is to save in the database all users by telegram id (let's say chaters) and also create a table of all the answers of all users (let's say messages) then create a many-to-many relationship table where there will be fields chater_id, message_id and timestamps. With each new message, save the message in the messages table and update the link table with the chat id and the id of his message
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question