auto-schedule-pro-v2: improve holiday exclusive easter egg (triggered at !пара)

This commit is contained in:
dymik739 2023-08-07 23:32:45 +03:00
parent 535087fae1
commit 1bd7fc2ef1
1 changed files with 10 additions and 4 deletions

View File

@ -144,7 +144,16 @@ def process(message, path):
reference_time = int(current_time.strftime("%s")) - current_seconds reference_time = int(current_time.strftime("%s")) - current_seconds
if base_command == "!пара": 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] upcoming_lessons = [timestamp for timestamp in schedule if timestamp > current_seconds - 5400]
if len(upcoming_lessons) > 0: 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, return "Актуальна пара: " + get_lesson_description(schedule, reference_time, closest_lesson_time, current_day,
current_week) current_week)
'''
return "Ви маєте законне право відпочити, пари почнуться не скоро"
elif base_command == "!пари": elif base_command == "!пари":
base_day = current_week * 7 + current_day base_day = current_week * 7 + current_day