From 01f113ec4c9f29f0560d912eb8805c392f655c9a Mon Sep 17 00:00:00 2001 From: Administrator Date: Fri, 28 Oct 2022 23:40:57 +0300 Subject: [PATCH] link --- daemons/fetch.py | 2 ++ daemons/notify.py | 2 ++ helpers/mongo.py | 3 ++- helpers/ruz.py | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/daemons/fetch.py b/daemons/fetch.py index 09751f8..ad3875b 100644 --- a/daemons/fetch.py +++ b/daemons/fetch.py @@ -22,6 +22,7 @@ def fetch_schedule_for_user(user: User): lesson = mongo.lessons_collection.find_one({ "discipline": element['discipline'], "auditorium": element['auditorium'], + "link": element['url1'], "hse_user_id": user.hse_id, "begin": datetime.datetime( year=int(year), @@ -35,6 +36,7 @@ def fetch_schedule_for_user(user: User): result = mongo.lessons_collection.insert_one({ "discipline": element['discipline'], "auditorium": element['auditorium'], + "link": element['url1'], "hse_user_id": user.hse_id, "begin": datetime.datetime( year=int(year), diff --git a/daemons/notify.py b/daemons/notify.py index 6feb29a..e8846d5 100644 --- a/daemons/notify.py +++ b/daemons/notify.py @@ -25,6 +25,8 @@ def process(): ans += f"🕑 {lesson['begin'].strftime('%H:%M')}\n" ans += f"🕗 {lesson['end'].strftime('%H:%M')}\n" ans += f"🧑‍🏫 {(lesson['lecturer'] or 'Неизвестно')}\n" + if lesson['link']: + ans += f"🌏 {lesson['link']}" try: bot.send_message( user["chat_id"], diff --git a/helpers/mongo.py b/helpers/mongo.py index 33b95ce..8039c24 100644 --- a/helpers/mongo.py +++ b/helpers/mongo.py @@ -26,7 +26,8 @@ class Mongo: ("discipline", 1), ("auditorium", 1), ("begin", 1), - ("hse_user_id", 1) + ("hse_user_id", 1), + ("link", 1) ]) self.lessons_collection.create_index([ ("hse_user_id", 1), diff --git a/helpers/ruz.py b/helpers/ruz.py index 7aa8c4d..cb958da 100644 --- a/helpers/ruz.py +++ b/helpers/ruz.py @@ -78,6 +78,8 @@ class RUZ: ans += f"🕑 {lesson['begin'].strftime('%H:%M')}\n" ans += f"🕗 {lesson['end'].strftime('%H:%M')}\n" ans += f"🧑‍ {(lesson['lecturer'] or 'Неизвестно')}\n" + if lesson['link']: + ans += f"🌏 {lesson['link']}" ans += "\n" return ans