R
R
RA4INA2021-07-03 21:45:51
Python
RA4INA, 2021-07-03 21:45:51

How to use if function many times?

There is an if function, but it only checks the value once, when the bot is turned on. What needs to be done so that she checks the value constantly or there once a minute.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Gornostaev, 2021-07-03
@sergey-gornostaev

if is a statement, not a function. The obvious solution that comes to mind first is to put it in a loop. But perhaps your bot has its own event loop, so you need to use the recheck library API.

D
Developer, 2021-07-03
@samodum

Dark options.
Up to the "Strategy" pattern,
everything depends on your code, which is not here

S
SKEPTIC, 2021-07-03
@pro100chel

Throw this function into a separate thread and let it be executed there every minute

E
Emil Timerbaev, 2021-07-15
@MrDlop

Put the function in which you have if in a separate thread if the data is not needed for users. If the data is for users, then you can just start processing, commands, text, photos, etc. You can run it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question