Answer the question
In order to leave comments, you need to log in
Running bots from the database?
Task: launch a lot of bots, with the possibility of adding new ones.
Launch example
for item in bot_list:
updater = Updater(
token=item.token,
use_context=True
)
Answer the question
In order to leave comments, you need to log in
Correctly.
How should the bot know that the token has changed in some database?
How to change the token on the fly in a running bot?
You probably need a service (a separate program) that will check the database and kick bots if something has changed.
Well, what's the problem then? You found a "bug", now think about what needs to be done to fix it.
You need to either update bot_list once in a while with new data from the database, or most likely repeat the cycle, because it goes through once and that's it, with a check already, whether such a bot is already working - if so, then we skip it.
Learn to think on your own, to understand what happens in general, for this you don’t even need to be able to program, you need to be able to think logically.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question