Browse Source

time2word: Fix message generation from MIDNIGHT_PHRASES and NOON_PHRASES

master
Sergey Kiselev 4 months ago
parent
commit
6a137600c6
  1. 6
      time2word

6
time2word

@ -44,9 +44,11 @@ def generate_message():
p_key, time_of_day = get_time_of_day(hour, minute) p_key, time_of_day = get_time_of_day(hour, minute)
if hour == 0 and minute == 0: if hour == 0 and minute == 0:
msg = random.choice(MIDNIGHT_PHRASES) tmpl = random.choice(MIDNIGHT_PHRASES)
msg = tmpl.format(h_word=h_word, h_sfx=h_sfx, time_of_day=time_of_day)
elif hour == 12 and minute == 0: elif hour == 12 and minute == 0:
msg = random.choice(NOON_PHRASES) tmpl = random.choice(NOON_PHRASES)
msg = tmpl.format(h_word=h_word, h_sfx=h_sfx, time_of_day=time_of_day)
elif minute == 0: elif minute == 0:
phrase_i = (hour % 12) % 6 phrase_i = (hour % 12) % 6
if (hour > 0 and hour < 6) or (hour > 12 and hour < 18): if (hour > 0 and hour < 6) or (hour > 12 and hour < 18):

Loading…
Cancel
Save