new log sender, refactor reminder.py

This commit is contained in:
Rykov7
2022-08-21 07:35:23 +03:00
parent a579762069
commit 6a4cd7f88b
4 changed files with 15 additions and 12 deletions
+4 -6
View File
@@ -28,13 +28,11 @@ def remind():
for entry in holidays[1:]:
date, holiday, description = entry
if today.month == dt.strptime(date, "%Y-%m-%d").month and today.day == dt.strptime(date, "%Y-%m-%d").day:
if dt.strptime(date, "%Y-%m-%d").year == 1:
notification = f'🎉💻 Сегодня {dt.strptime(date, "%m-%d"):%d.%m}, <b><u>{holiday.upper()}</u></b>! \
\n\n{description}.'
else:
notification = f'🎉💻 Сегодня {dt.strptime(date, "%m-%d"):%d.%m}, <b><u>{holiday.upper()}</u></b>! \
\n\n{description}.'
if dt.strptime(date, "%Y-%m-%d").year != 1:
age = today.year - dt.strptime(date, "%Y-%m-%d").year
notification = f'🎉💻 Сегодня {dt.strptime(date, "%Y-%m-%d"):%d.%m}, <b><u>{holiday.upper()}</u></b>! \
\n\n{description}.\n<i>{age} годовщина</i>'
notification += f'\n<i>{age} годовщина</i>'
bot.send_message(PYTHONCHATRU, notification, parse_mode='HTML') # PYTHONCHATRU