Answer the question
In order to leave comments, you need to log in
Is it possible for the bot to work offline?
Hello everyone, I have a community bot that manages other bots (User Pages), This bot is just needed to run pages to send messages to users at a specified time. And I have a problem:
After the user has configured all the parameters of the bots, he must start the process of the bots by clicking on the start button. And this is where the problems begin: the bot needs to constantly watch what time it is, and if the time has come that the user specified for the bots to work, you need to start this process, after execution, return to checking the current time again.
I thought to make a cycle in which the bot leaves after pressing the "Start" button, and the current time is constantly checked there, but there was a problem if it enters this cycle, it cannot accept the "Stop" command from the user because it is in the cycle. Here is such a problem, the only way to solve the problem I see is to manually start all the bots. Like people press start and the bots do their job and then issue a report that they have finished. If you use this method, then the bot will not work completely autonomously.
Is it possible to implement autonomous operation of this bot? How to logically arrange all this? I'm not asking you to write code for me.
Answer the question
In order to leave comments, you need to log in
What's stopping you from creating a cron job? When the user clicks "run" in the database, the task becomes active. When the bot is launched by the cron, it looks at all active tasks in the database, compares them with the launch time, and if the time has come, it launches the task, if not, it completes the work before the next launch.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question