X
X
Xacker_Name2021-10-14 07:05:32
Bots
Xacker_Name, 2021-10-14 07:05:32

How to check payment status every 5 minutes in python in telegram bot?

How to check payment status every 5 minutes in python in telegram bot, but without time.sleep(), because the whole bot stops

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2021-10-14
@rt2233

The easiest way is to run the check function in a separate thread. Flow examples here .

R
Ramis, 2021-10-14
@ramzis

If you have a loop where you check for updates in your telegram bot via getUpdates , then you can add this.

import time
check_time = int(time.time())

while True:
    if int(time.time()) - check_time >= 5:
        check_time = int(time.time())
        print('проверяем статус платежа каждые 5 секунд')

Replacing 5 with 300 (5min)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question