Answer the question
In order to leave comments, you need to log in
Python telegram bot after button click, response time or cancel after timer expires?
Here is part of the code
if message.text == 'Оплата':
bottons =
keyboard = ReplyKeyboardMarkup(bottons, resize_keyboard=True)
bot.send_photo(message.chat.id,'путь к картинке', parse_mode='markdown', caption = texts.tov % (tovar, city, rayon, tovari, random.randint(1, 100000)), reply_markup=keyboard)
Answer the question
In order to leave comments, you need to log in
I would do it via threading.Timer
import threading
def ordertimeout():
pass ## в этой функции отменяй, пиши, отправляй...
t = threading.Timer(60*10, ordertimeout) # 10 минут (или 600 секунд)
t.start() # время пошло!
t.cancel() # отмена, не будет запущен
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question