From 1bd7fc2ef1bd4cc60115dbeaee944e08cd806276 Mon Sep 17 00:00:00 2001 From: dymik739 Date: Mon, 7 Aug 2023 23:32:45 +0300 Subject: [PATCH] =?UTF-8?q?auto-schedule-pro-v2:=20improve=20holiday=20exc?= =?UTF-8?q?lusive=20easter=20egg=20(triggered=20at=20!=D0=BF=D0=B0=D1=80?= =?UTF-8?q?=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/auto-schedule-pro-v2/main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/auto-schedule-pro-v2/main.py b/modules/auto-schedule-pro-v2/main.py index 81e36d6..2fe9f96 100644 --- a/modules/auto-schedule-pro-v2/main.py +++ b/modules/auto-schedule-pro-v2/main.py @@ -144,7 +144,16 @@ def process(message, path): reference_time = int(current_time.strftime("%s")) - current_seconds if base_command == "!пара": - ''' + study_begin_ts = int(datetime(year=2023, month=9, day=4).strftime("%s")) + current_ts = int(datetime.now().strftime("%s")) + + if -3600*4 < study_begin_ts - current_ts < 0: + return "Навчання незабаром розпочнеться!" + elif 0 <= study_begin_ts - current_ts < 1209600: + return f"До навчання залишилося {study_begin_ts - current_ts} секунд..." + elif study_begin_ts - current_ts >= 1209600: + return "Ви маєте законне право відпочити, пари почнуться не скоро" + upcoming_lessons = [timestamp for timestamp in schedule if timestamp > current_seconds - 5400] if len(upcoming_lessons) > 0: @@ -154,9 +163,6 @@ def process(message, path): return "Актуальна пара: " + get_lesson_description(schedule, reference_time, closest_lesson_time, current_day, current_week) - ''' - - return "Ви маєте законне право відпочити, пари почнуться не скоро" elif base_command == "!пари": base_day = current_week * 7 + current_day