def scheduled_news(): students = Students.get_all_chat_ids_and_pgroup() today_date = datetime.today().date() news = NewsProvider.getNews(3) news_text = Utils.create_human_readable_news(news) weather = WeatherProvider.getWeatherForDate(today_date) weather_text = Utils.create_weather_for_today(weather) for student in students: bot.send_message(student['chatId'], f"{news_text}\n\n{weather_text}")
def task_list(message): user_login = message.from_user.username group_num = Students.get_group_num(user_login) today_date = datetime.today().date() if group_num: news = NewsProvider.getNews(3) news_text = Utils.create_human_readable_news(news) weather = WeatherProvider.getWeatherForDate(today_date) weather_text = Utils.create_weather_for_today(weather) bot.send_message(message.chat.id, f"{news_text}\n\n{weather_text}") else: bot.send_message(message.chat.id, CommonMessages.set_group) UserStatus.del_user_status(user_login)