Answer the question
In order to leave comments, you need to log in
How to get user_id from sqlite database, check if there is a subscription and send this person a message in a chat with a bot?
Initially, after entering the /start command, the bot registers the usek_id in the database.
Then, the user can buy a paid subscription, when he does, in the database, in the time_sub column, he is given 30 days in seconds.
def set_time_sub(self, user_id, time_sub):
with self.connection:
return self.cursor.execute("UPDATE `users` SET `time_sub` = ? WHERE `user_id` = ?", (time_sub, user_id,))
Answer the question
In order to leave comments, you need to log in
Didn't understand what the problem is? In the database, store for each userid the "subscription end date and time" field. It is necessary to make a mailing list - you sort through all the userid and send a message to those who have this field greater than the current datetime; do not send to others.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question