Skip to content Skip to sidebar Skip to footer

How To Create A Telegram Bot That Only Works For 30 Days Per User And Then Stops There?

I built a telegram bot with a Python-Telegram-bot module, and now I want to set it up to work only 30 days, that is, when the user sends the /start to the bot, the bot will stop fo

Solution 1:

The first time a user starts the bot, you need to log a timestamp in a database along with his telegram ID.

For example you create a table with INT primary key and timestamp for the first usage.

For any "/start" command the bot receives, you insert the ID and the timestamp into the table - if it is already present you do nothing.

Anytime a message arrives to your bot, you check if the 30 days have passed or not.

Post a Comment for "How To Create A Telegram Bot That Only Works For 30 Days Per User And Then Stops There?"