From 2feba359e22f7e3096ec1259bc983bda1feb7cf2 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Sun, 5 Mar 2023 19:34:00 +0100 Subject: [PATCH 1/5] Rename bot.py to main.py --- src/bot/telegram/{bot.py => main.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/bot/telegram/{bot.py => main.py} (100%) diff --git a/src/bot/telegram/bot.py b/src/bot/telegram/main.py similarity index 100% rename from src/bot/telegram/bot.py rename to src/bot/telegram/main.py From a46fa83505c1b96bdaa67d4f4e2c243a0bce14c8 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Sun, 5 Mar 2023 19:37:58 +0100 Subject: [PATCH 2/5] Create requirements.txt --- src/bot/telegram/requirements.txt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/bot/telegram/requirements.txt diff --git a/src/bot/telegram/requirements.txt b/src/bot/telegram/requirements.txt new file mode 100644 index 0000000..7e79195 --- /dev/null +++ b/src/bot/telegram/requirements.txt @@ -0,0 +1,6 @@ +pybson==0.5.9 +python-dotenv==0.21.0 +telebot==0.0.5 +schedule==1.1.0 +pymongo==4.3.3 +urllib3==1.26.13 From ae231d7952f36b3f1159159116e4e21e8a948619 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Mon, 6 Mar 2023 16:15:11 +0100 Subject: [PATCH 3/5] Update main.py --- src/bot/telegram/main.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index b3f9e81..6dd664d 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -58,32 +58,32 @@ def send_notification(): if now.strftime("%H:%M") == "07:50": for i in find_document: for b in array_username: - bot.send_message(b, str(i['School Subject']['Monday'][0]['Room']) + ", " + i['School Subject']['Monday'][0]['Teacher'] + ", " + i['School Subject']['Monday'][0]['Subject'] + "\n" + "Successiva: " + str(i['School Subject']['Monday'][1]['Room']) + ", " + i['School Subject']['Monday'][1]['Teacher'] + ", " + i['School Subject']['Monday'][1]['Subject']) + bot.send_message(b, str(i['School Subject'][today][0]['Room']) + ", " + i['School Subject'][today][0]['Teacher'] + ", " + i['School Subject'][today][0]['Subject'] + "\n" + "Successiva: " + str(i['School Subject'][today][1]['Room']) + ", " + i['School Subject'][today][1]['Teacher'] + ", " + i['School Subject'][today][1]['Subject']) recheck() - elif now.strftime("%H:%M") == "8:50": + elif now.strftime("%H:%M") == "08:50": for i in find_document: for b in array_username: - bot.send_message(b, str(i['School Subject']['Monday'][1]['Room']) + ", " + i['School Subject']['Monday'][1]['Teacher'] + ", " + str(i['School Subject']['Monday'][1]['Subject']) + "\n" + "Successiva: " + str(i['School Subject']['Monday'][2]['Room']) + ", " + i['School Subject']['Monday'][2]['Teacher'] + ", " + i['School Subject']['Monday'][2]['Subject']) + bot.send_message(b, str(i['School Subject'][today][1]['Room']) + ", " + i['School Subject'][today][1]['Teacher'] + ", " + str(i['School Subject'][today][1]['Subject']) + "\n" + "Successiva: " + str(i['School Subject'][today][2]['Room']) + ", " + i['School Subject'][today][2]['Teacher'] + ", " + i['School Subject'][today][2]['Subject']) recheck() - elif now.strftime("%H:%M") == "9:50": + elif now.strftime("%H:%M") == "09:50": for i in find_document: for b in array_username: - bot.send_message(b, str(i['School Subject']['Monday'][2]['Room']) + ", " + i['School Subject']['Monday'][2]['Teacher'] + ", " + str(i['School Subject']['Monday'][2]['Subject']) + "\n" + "Successiva: " + str(i['School Subject']['Monday'][3]['Room']) + ", " + i['School Subject']['Monday'][3]['Teacher'] + ", " + i['School Subject']['Monday'][3]['Subject']) + bot.send_message(b, str(i['School Subject'][today][2]['Room']) + ", " + i['School Subject'][today][2]['Teacher'] + ", " + str(i['School Subject'][today][2]['Subject']) + "\n" + "Successiva: " + str(i['School Subject'][today][3]['Room']) + ", " + i['School Subject'][today][3]['Teacher'] + ", " + i['School Subject'][today][3]['Subject']) recheck() elif now.strftime("%H:%M") == "11:05": for i in find_document: for b in array_username: - bot.send_message(b, str(i['School Subject']['Monday'][3]['Room']) + ", " + i['School Subject']['Monday'][3]['Teacher'] + ", " + str(i['School Subject']['Monday'][3]['Subject']) + "\n" + "Successiva: " + str(i['School Subject']['Monday'][4]['Room']) + ", " + i['School Subject']['Monday'][4]['Teacher'] + ", " + i['School Subject']['Monday'][4]['Subject']) + bot.send_message(b, str(i['School Subject'][today][3]['Room']) + ", " + i['School Subject'][today][3]['Teacher'] + ", " + str(i['School Subject'][today][3]['Subject']) + "\n" + "Successiva: " + str(i['School Subject'][today][4]['Room']) + ", " + i['School Subject'][today][4]['Teacher'] + ", " + i['School Subject'][today][4]['Subject']) recheck() elif now.strftime("%H:%M") == "12:05": for i in find_document: for b in array_username: - bot.send_message(b, str(i['School Subject']['Monday'][4]['Room']) + ", " + i['School Subject']['Monday'][4]['Teacher'] + ", " + str(i['School Subject']['Monday'][4]['Subject']) + "\n" + "Successiva: " + str(i['School Subject']['Monday'][5]['Room']) + ", " + i['School Subject']['Monday'][5]['Teacher'] + ", " + i['School Subject']['Monday'][5]['Subject']) + bot.send_message(b, str(i['School Subject'][today][4]['Room']) + ", " + i['School Subject'][today][4]['Teacher'] + ", " + str(i['School Subject'][today][4]['Subject']) + "\n" + "Successiva: " + str(i['School Subject'][today][5]['Room']) + ", " + i['School Subject'][today][5]['Teacher'] + ", " + i['School Subject'][today][5]['Subject']) recheck() elif now.strftime("%H:%M") == "13:05": for i in find_document: for b in array_username: - bot.send_message(b, str(i['School Subject']['Monday'][5]['Room']) + ", " + i['School Subject']['Monday'][5]['Teacher'] + ", " + str(i['School Subject']['Monday'][5]['Subject'])) + bot.send_message(b, str(i['School Subject'][today][5]['Room']) + ", " + i['School Subject'][today][5]['Teacher'] + ", " + str(i['School Subject'][today][5]['Subject'])) recheck() elif now.strftime("%H:%M") == "21:00": if tomorrow == "Sunday" or tomorrow == "Saturday": @@ -95,7 +95,7 @@ def send_notification(): else: recheck() -schedule.every().day.at("07:50").do(send_notification) +schedule.every().day.at("16:16").do(send_notification) now = datetime.datetime.now() t1 = threading.Thread(target=bot.polling).start() From 88097ac5885e6aa2357790018a780fd3c5244394 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Mon, 6 Mar 2023 16:18:56 +0100 Subject: [PATCH 4/5] Update main.py --- src/bot/telegram/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index 6dd664d..83b7343 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -95,7 +95,7 @@ def send_notification(): else: recheck() -schedule.every().day.at("16:16").do(send_notification) +schedule.every().day.at("16:25").do(send_notification) now = datetime.datetime.now() t1 = threading.Thread(target=bot.polling).start() From d6668d255df8620662f687c92a86029a8dad94d4 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Mon, 6 Mar 2023 16:34:00 +0100 Subject: [PATCH 5/5] Update main.py --- src/bot/telegram/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index 83b7343..a055877 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -95,7 +95,7 @@ def send_notification(): else: recheck() -schedule.every().day.at("16:25").do(send_notification) +schedule.every().day.at("07:50").do(send_notification) now = datetime.datetime.now() t1 = threading.Thread(target=bot.polling).start()