I'm built a telegram bot for the groups.When the bot is added to the group, it will delete messages containing ads.How can I change the bot to work for only 30 days in each group and then stop it? That means, for example, today's bot is added to group 1 and the next week the bot is added to group 2; I need to change the bot to stop the 30 days in group 1 and stop it in group 2 for another 37 days. How can I do that?
How can a telegram bot change that works only for a specific time in a group?
365 Views Asked by Sajjad At
2
There are 2 best solutions below
0
On
Simply, all you need is a database at the back-end. Just store the group_id and join_date in each row.
At any time, you can query your database. If more than 30 days has passed join_date, stop the bot or leave the group.
You can also use any other storage rather than a database. A file, index, etc.
You can't know how long your bot had been added to group at this time. :(
You need to log it to your own database, and there is
leaveChatmethod if you need it.