D
D
Danil Neskazhu2020-08-06 16:58:54
Python
Danil Neskazhu, 2020-08-06 16:58:54

How to implement self-repeating function with timer in aiogram/pyTelegramBotAPI?

Good day!

There is a function that sends messages to bot users.
You need to make sure that this function works every hour.
How can and how best to implement this if my bot works on webhooks?

Thanks in advance to everyone for the replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Tikhonov, 2020-08-17
@dannight0151

Run in a separate thread (or coroutine, depending on what's inside) while True: sleep(3600) and send.
Or just add a send script to cron.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question