From aee793deb4ed2775ef1cdf8a1e4fa8732e5f5024 Mon Sep 17 00:00:00 2001 From: Florian Kellermann Date: Tue, 5 Apr 2022 15:17:04 +0200 Subject: [PATCH] creating sends from crontab in work --- telegram_bot/bot_updates.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/telegram_bot/bot_updates.py b/telegram_bot/bot_updates.py index e729e8a..5467aad 100644 --- a/telegram_bot/bot_updates.py +++ b/telegram_bot/bot_updates.py @@ -78,13 +78,29 @@ def update_crontab(pCurrent_Time): def update_based_on_crontab(pCurrent_Time): current_time_ctime = time.ctime() + + if str(current_time_ctime).split(' ')[0] == "Mon": + current_day = 0 + elif str(current_time_ctime).split(' ')[0] == "Tue": + current_day = 1 + elif str(current_time_ctime).split(' ')[0] == "Wed": + current_day = 3 + elif str(current_time_ctime).split(' ')[0] == "Thu": + current_day = 4 + elif str(current_time_ctime).split(' ')[0] == "Fri": + current_day = 5 + elif str(current_time_ctime).split(' ')[0] == "Sat": + current_day = 6 + elif str(current_time_ctime).split(' ')[0] == "Sun": + current_day = 7 + else: + print('Error with time code') + sys.exit(-1) + for i in range(len(user_crontab)): print('tbd') - time.sleep(60) - - def send_to_user(pText, pUser_id = 1770205310):