diff --git a/state_machine.py b/state_machine.py index 6e91577..688d267 100644 --- a/state_machine.py +++ b/state_machine.py @@ -78,7 +78,23 @@ def switchToListen(): # Переход на "Говорю время" и возвращаюсь в "Начало" def switchToTime(): now = datetime.datetime.now() - speaker.speak(f"Сейчас {now.hour} часов, {now.minute} минут") + time = f'Сейчас {now.hour} ' + if now.hour == 0 or 5 <= now.hour <= 20: + time += 'часов ' + if now.hour == 1 or now.hour == 21: + time += 'час ' + if 2 <= now.hour % 20 <= 4: + time += 'часАА ' # тянем слог + + time += str(now.minute) + if now.minute % 10 == 1 and now.minute != 11: + time += ' минута' + elif 5 <= now.minute <= 20 or 25 <= now.minute <= 30 or 35 <= now.minute <= 40 or 45 <= now.minute <= 50 or 55 <= now.minute: + time += ' минут' + else: + time += ' минуты' + + speaker.speak(time) return "Начало" def _precipitation_today_message(precipitations:list):