I think it is possible to make a table of users in the database for storing passwords, for example. fields [user_id, password]
, password stored as a hash, the user enters /login <password>
, the bot scans the string and checks the hash of the entered password and the hash in the database corresponding to this user (you must enter the registration when the bot is connected to enter the password in the database ), only you need to figure out how to store the session (for example, you can add a date field to the users table (then the table fields will look like [user_id, password, session_date]
) before the session, if the current date is less than the date in the session_date
field, then the user is authorized, if more - then there is no authorization is required, by after which the session_date
field is updated (for example, the session time is an hour, then we write the текущее время текущей даты + час
in the field), if the user logged out himself /logout
, then in the session_date
field we write, for example, 0
(if the date and time are stored in the Unix Timestamp) , then the user will be "unauthorized").
I am sure that bots can use DB, since other bots "memorized" some of the data I entered.
If anything, I did not write bots for the cart (but I plan as soon as my hands reach, and even became interested in this idea and try to embody it, I am sure that it is possible), and only guess how you can implement it, so do not throw at once if I’m in what is wrong
If you put minuses for my any mistakes, then please, write in the comments the reason and what is wrong, thank you.