Answer the question
In order to leave comments, you need to log in
Multi-user telegram bot signals?
Good afternoon ! I need a little help) I am writing a bot to notify users about changes in the temperature on the street (every hour the user receives a notification about the temperature on the street CHOSEN by him). Actually this is the problem. I am using the States library for python. When you click on the Pushkin street button (for example), the state changes to 1 . But if the second user clicks on Lenin Street, data from Lenin Street will be sent to the first and second users. I had an idea for a solution to send messages by user id, which I will recognize when the bot is activated. But I can't understand how I can replace the states in the code and how I can write an algorithm that will understand which user to send data from which street. It should all be asynchronous. I write on aiogram. If there are links to solutions in similar comments or to books where it is described how to do this, or just ideas and suggestions, I will be very happy !! Thank you very much !)
Answer the question
In order to leave comments, you need to log in
In your case, when activating the bot, you can write the street ID to the database and whether the bot is activated,
And so in the database 3 users
151424 Pushkina True
125463 Kukushkina False
124143 Brilliant True The
bot takes from the database those users whose bot is activated (Well, no need already the user to know the temperature every hour)
And just every hour we take everyone from the database and in a cycle we request the temperature along the street and send it to ID
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question