From 35ba87e2467d2ff86239c2e9ddeef4dcb352387a Mon Sep 17 00:00:00 2001 From: "re.kovalev" Date: Sat, 21 May 2022 23:35:29 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=BD=D0=BE=D0=B5=20=D1=81=D0=BA=D0=BB=D0=BE=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- state_machine.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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):