From 03dc72fdc6b146796301777f0e23542b032bd4c9 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Tue, 7 Mar 2023 07:57:25 +0100 Subject: [PATCH 01/10] Update main.py --- src/bot/telegram/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index 0c6f084..ceef504 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -82,9 +82,9 @@ def send_notification(): for b in array_username: bot.send_message(b, i['School Subject'][tomorrow][0]['Subject'] + ", " + i['School Subject'][tomorrow][0]['Teacher'] + "\n" + i['School Subject'][tomorrow][1]['Subject'] + ", " + i['School Subject'][tomorrow][1]['Teacher'] + "\n" + i['School Subject'][tomorrow][2]['Subject'] + ", " + i['School Subject'][tomorrow][2]['Teacher'] + "\n" + i['School Subject'][tomorrow][3]['Subject'] + ", " + i['School Subject'][tomorrow][3]['Teacher'] + "\n" + i['School Subject'][tomorrow][4]['Subject'] + ", " + i['School Subject'][tomorrow][4]['Teacher'] + "\n" + i['School Subject'][tomorrow][5]['Subject'] + ", " + i['School Subject'][tomorrow][5]['Teacher']) -schedule.every().day.at("07:50").do(send_notification) -schedule.every().day.at("08:50").do(send_notification) -schedule.every().day.at("09:50").do(send_notification) +schedule.every().day.at("7:50").do(send_notification) +schedule.every().day.at("8:50").do(send_notification) +schedule.every().day.at("9:50").do(send_notification) schedule.every().day.at("11:05").do(send_notification) schedule.every().day.at("12:05").do(send_notification) schedule.every().day.at("13:05").do(send_notification) From c9e971c6bfb1634d854f9272b94f55b975a9c13e Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Tue, 7 Mar 2023 10:57:12 +0100 Subject: [PATCH 02/10] Update main.py --- src/bot/telegram/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index ceef504..0c6f084 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -82,9 +82,9 @@ def send_notification(): for b in array_username: bot.send_message(b, i['School Subject'][tomorrow][0]['Subject'] + ", " + i['School Subject'][tomorrow][0]['Teacher'] + "\n" + i['School Subject'][tomorrow][1]['Subject'] + ", " + i['School Subject'][tomorrow][1]['Teacher'] + "\n" + i['School Subject'][tomorrow][2]['Subject'] + ", " + i['School Subject'][tomorrow][2]['Teacher'] + "\n" + i['School Subject'][tomorrow][3]['Subject'] + ", " + i['School Subject'][tomorrow][3]['Teacher'] + "\n" + i['School Subject'][tomorrow][4]['Subject'] + ", " + i['School Subject'][tomorrow][4]['Teacher'] + "\n" + i['School Subject'][tomorrow][5]['Subject'] + ", " + i['School Subject'][tomorrow][5]['Teacher']) -schedule.every().day.at("7:50").do(send_notification) -schedule.every().day.at("8:50").do(send_notification) -schedule.every().day.at("9:50").do(send_notification) +schedule.every().day.at("07:50").do(send_notification) +schedule.every().day.at("08:50").do(send_notification) +schedule.every().day.at("09:50").do(send_notification) schedule.every().day.at("11:05").do(send_notification) schedule.every().day.at("12:05").do(send_notification) schedule.every().day.at("13:05").do(send_notification) From 0e77be9e070943038734b721462facd67ed167b8 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Tue, 7 Mar 2023 15:41:00 +0100 Subject: [PATCH 03/10] Update main.py --- src/bot/telegram/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index 0c6f084..a65e0db 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -82,15 +82,17 @@ def send_notification(): for b in array_username: bot.send_message(b, i['School Subject'][tomorrow][0]['Subject'] + ", " + i['School Subject'][tomorrow][0]['Teacher'] + "\n" + i['School Subject'][tomorrow][1]['Subject'] + ", " + i['School Subject'][tomorrow][1]['Teacher'] + "\n" + i['School Subject'][tomorrow][2]['Subject'] + ", " + i['School Subject'][tomorrow][2]['Teacher'] + "\n" + i['School Subject'][tomorrow][3]['Subject'] + ", " + i['School Subject'][tomorrow][3]['Teacher'] + "\n" + i['School Subject'][tomorrow][4]['Subject'] + ", " + i['School Subject'][tomorrow][4]['Teacher'] + "\n" + i['School Subject'][tomorrow][5]['Subject'] + ", " + i['School Subject'][tomorrow][5]['Teacher']) +schedule.every().day.at("06:50").do(send_notification) schedule.every().day.at("07:50").do(send_notification) schedule.every().day.at("08:50").do(send_notification) -schedule.every().day.at("09:50").do(send_notification) +schedule.every().day.at("10:05").do(send_notification) schedule.every().day.at("11:05").do(send_notification) schedule.every().day.at("12:05").do(send_notification) -schedule.every().day.at("13:05").do(send_notification) schedule.every().day.at("21:00").do(send_notification) now = datetime.datetime.now() t1 = threading.Thread(target=bot.polling).start() while True: + now = datetime.datetime.now() + print(now) schedule.run_pending() From f7f9181c6c4779b0db640a4710ea1162999c1c6d Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Tue, 7 Mar 2023 15:45:15 +0100 Subject: [PATCH 04/10] Update main.py --- src/bot/telegram/main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index a65e0db..3e63e1e 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -50,27 +50,27 @@ def send_notification(): array_username = collection_find_username[0]["username"] #Array with all username #gaga = find_document['School Subject'][today][0]['Subject'] print(now.strftime("%H:%M")) - if now.strftime("%H:%M") == "07:50": + if now.strftime("%H:%M") == "06:50": for i in find_document: for b in array_username: 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']) - elif now.strftime("%H:%M") == "08:50": + elif now.strftime("%H:%M") == "07:50": for i in find_document: for b in array_username: 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']) - elif now.strftime("%H:%M") == "09: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'][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']) - elif now.strftime("%H:%M") == "11:05": + elif now.strftime("%H:%M") == "10:05": for i in find_document: for b in array_username: 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']) - elif now.strftime("%H:%M") == "12:05": + 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'][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']) - elif now.strftime("%H:%M") == "13:05": + 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'][today][5]['Room']) + ", " + i['School Subject'][today][5]['Teacher'] + ", " + str(i['School Subject'][today][5]['Subject'])) From 9894a6957c259dcc9946599a4c8381194c7ba097 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Tue, 7 Mar 2023 15:45:34 +0100 Subject: [PATCH 05/10] Update main.py --- src/bot/telegram/main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index 3e63e1e..3f90921 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -93,6 +93,4 @@ now = datetime.datetime.now() t1 = threading.Thread(target=bot.polling).start() while True: - now = datetime.datetime.now() - print(now) schedule.run_pending() From 4e0e1c545feeb8272b80971a89336fb11caa0887 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Fri, 10 Mar 2023 20:04:54 +0100 Subject: [PATCH 06/10] Update main.py --- src/bot/telegram/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index 3f90921..93aeacb 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -93,4 +93,5 @@ now = datetime.datetime.now() t1 = threading.Thread(target=bot.polling).start() while True: + time.sleep(10) schedule.run_pending() From 2b7665f8add77f82b2d4bafabf674a01f66b004f Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Fri, 10 Mar 2023 20:06:03 +0100 Subject: [PATCH 07/10] Update main.py --- src/bot/telegram/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index 93aeacb..1041dbc 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -3,6 +3,7 @@ from dotenv import load_dotenv from telebot import telebot import threading import datetime +import time import schedule import pymongo import urllib From f336cffa607449d6e443a9fc78d09cb6a7957bf9 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Sat, 11 Mar 2023 10:19:13 +0100 Subject: [PATCH 08/10] Update main.py --- src/bot/telegram/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index 1041dbc..4fe5c94 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -91,7 +91,6 @@ schedule.every().day.at("11:05").do(send_notification) schedule.every().day.at("12:05").do(send_notification) schedule.every().day.at("21:00").do(send_notification) now = datetime.datetime.now() -t1 = threading.Thread(target=bot.polling).start() while True: time.sleep(10) From 792be8591b73aa3dce005fcce14d8341f3837760 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Sat, 11 Mar 2023 18:33:05 +0100 Subject: [PATCH 09/10] Update main.py --- src/bot/telegram/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bot/telegram/main.py b/src/bot/telegram/main.py index 4fe5c94..1041dbc 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -91,6 +91,7 @@ schedule.every().day.at("11:05").do(send_notification) schedule.every().day.at("12:05").do(send_notification) schedule.every().day.at("21:00").do(send_notification) now = datetime.datetime.now() +t1 = threading.Thread(target=bot.polling).start() while True: time.sleep(10) From fb2df8c65835b7fa7c6f7a4b8f53bfc5c191ebe5 Mon Sep 17 00:00:00 2001 From: Stefano Assenzo Date: Sat, 11 Mar 2023 19:03:41 +0100 Subject: [PATCH 10/10] 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 1041dbc..3e0692b 100644 --- a/src/bot/telegram/main.py +++ b/src/bot/telegram/main.py @@ -91,7 +91,7 @@ schedule.every().day.at("11:05").do(send_notification) schedule.every().day.at("12:05").do(send_notification) schedule.every().day.at("21:00").do(send_notification) now = datetime.datetime.now() -t1 = threading.Thread(target=bot.polling).start() +#t1 = threading.Thread(target=bot.polling).start() while True: time.sleep(10)