I make a weather application. Stuck on setting up a mailing schedule.

Task: the user writes the time in the "08:30" format and the next time at 08:30 he should receive a weather forecast.

The first is how to parse the message from the user in such a way that a schedule would be created. And second, how can you actually make this schedule?

In my opinion it should be something like this:

from datetime import datetime if time_alarm == datetime.now("%Y, 08, 30, %h, %m, %s, %ms"): #сравнивается нынешнее время и заданное пользователем print ("prognoz na den") 

With the syntax obviously namudil, but I think, brought his train of thought.

  • And use cron for a schedule? - drstannum
  • I do not think that an option. This all should be in the process of work telegram-bot. I do not think that he will make friends with cron. Yes, and I do not know how to work with the crown. - DozenFrozen
  • You have a task to divide into: - a subscription via bot's telegrams for the weather - sending push notifications You can subscribe in your bot and run the script via cron (written at least on the database), which will send messages - Dmitry Erohin

0