Answer the question
In order to leave comments, you need to log in
How can a bot send a message if the user hasn't entered anything?
I have a question from a bot
mes = bot.send_message(call.chat.id, text="Введите запрос:")
bot.register_next_step_handler(mes, get_data_func)
Answer the question
In order to leave comments, you need to log in
You can't do this with the standard tools of this library.
I can offer an alternative:
When registering register_next_step_handler , pass one more parameter, which will be equal to the date of the message mes.date , and pass this parameter to the get_data_func function. In the get_data_func itself, check the difference between the date of the user's new message and the date of the previous message. If more than 10 hours - break the current script and issue a new message.
...
mes = bot.send_message(call.chat.id, text="Введите запрос:")
bot.register_next_step_handler(mes, get_data_func, mes.date)
...
def get_data_func(message, date):
if message.date-date > 36000: # 10 часов в секундах
<тут уже ваши действия>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question