From cc82547b81b33acf30d117e499124c9b49a0114e Mon Sep 17 00:00:00 2001 From: Administrator Date: Fri, 21 Oct 2022 15:23:47 +0300 Subject: [PATCH] pass --- daemons/notify.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/daemons/notify.py b/daemons/notify.py index 4ad59c3..a8a69f6 100644 --- a/daemons/notify.py +++ b/daemons/notify.py @@ -2,6 +2,8 @@ import datetime import zoneinfo from time import sleep +from telebot.apihelper import ApiTelegramException + from daemons.bot import bot from helpers.mongo import mongo @@ -20,10 +22,13 @@ def process(): ans += "Начало: " + lesson["begin"].strftime("%H:%M") + "\n" ans += "Конец: " + lesson["end"].strftime("%H:%M") + "\n" ans += "Преподаватель: " + (lesson["lecturer"] or "Неизвестно") + "\n" - bot.send_message( - user["chat_id"], - "Уведомляю о занятиях!\n" + ans - ) + try: + bot.send_message( + user["chat_id"], + "Уведомляю о занятиях!\n" + ans + ) + except ApiTelegramException: + pass mongo.lessons_collection.update_one({"_id": lesson['_id']}, {"$set": {"notified": True}})