From e458da2f5530331d375114b033f7c3fdd502cfaa Mon Sep 17 00:00:00 2001 From: Pavel_Duron Date: Thu, 3 Nov 2022 22:13:45 +1000 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=81=D0=BA=D0=BB=D0=BE=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=20=D0=BE=D1=82=20=D1=87=D0=B8=D1=81=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bot.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 1cac901..e352a75 100644 --- a/bot.py +++ b/bot.py @@ -22,7 +22,17 @@ async def send_time(message: types.Message): ct1 = ct+datetime.timedelta(hours=14) # +14 часов от сервера ct2 = ct1.strftime('%H:%M') # форматирует датувремя просто во время(ч,м) raznitsa = (new_year - ct).days #отнимает от нг текущее время и получаем разницу в днях - await message.reply(f'Сегодня {cd} \nВремя: {ct2} \nДо Нового Года осталось {raznitsa} дней(-я)') + + days = ['день', 'дня', 'дней'] + if raznitsa % 10 == 1 and raznitsa % 100 != 11: + p = 0 + elif 2 <= raznitsa % 10 <= 4 and (raznitsa % 100 < 10 or raznitsa % 100 >= 20): + p = 1 + else: + p = 2 + num=(str(raznitsa) + ' ' + days[p]) + + await message.reply(f'Сегодня {cd} \nВремя: {ct2} \nДо Нового Года осталось {num}')