diff --git a/.gitignore b/.gitignore index ab905e8..ff3258d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ geckodriver.log all.log __pycache__ test.py -school_time.xlsx \ No newline at end of file +school_time.xlsx +venv \ No newline at end of file diff --git a/src/events/school_time/discord_bot.py b/src/events/school_time/discord_bot.py index b9f9539..5f5f38b 100644 --- a/src/events/school_time/discord_bot.py +++ b/src/events/school_time/discord_bot.py @@ -33,8 +33,14 @@ async def orario(): for day in document['School Subject']: for i, subject in enumerate(document['School Subject'][day]): if subject['Subject'] == "CALF1 LINGUA ITALIANA": - channel = bot.get_channel(1063753802638954519) - #await ctx.send(f"Subject found: {subject['Subject']} at index: {i}") - await channel.send(f"Hours school: {i}, Subject: {subject['Subject']}, Teacher: {subject['Teacher']}, Room: {subject['Room']}") + print(f"Subject found: {subject['Subject']} at index: {i}") + # Send a message on channel #general with the subject found and the index of the subject + channel = bot.get_channel(1063753802638954519).send("bot is online") + await ctx.send(f"Subject found: {subject['Subject']} at index: {i}") + +@bot.command() +async def testpy(ctx): + bot.loop.create_task(orario(ctx)) + await ctx.send("testpy") bot.run(DISCORD_TOKEN) \ No newline at end of file diff --git a/src/events/school_time/update_time_school.py b/src/events/school_time/update_time_school.py index 2fc913f..103d5e8 100644 --- a/src/events/school_time/update_time_school.py +++ b/src/events/school_time/update_time_school.py @@ -322,13 +322,12 @@ def update_time_school(): day = str(ws.cell(row=i, column=3).value) # Get day from excel file school_subject = ws.cell(row=i, column=column).value # Get school subject from excel file teacher = ws.cell(row=i, column=column+1).value - room = ws.cell(row=i, column=column+2) + room = ws.cell(row=i, column=column+2).value if dont_repeat == 9: - check_repeat += 1 # 13 + check_repeat += 1 if check_repeat == 5: check_repeat = 0 dont_repeat = 0 - #number = 1 else: if day == "None": if school_subject == 0: #If school subject is 0, add "null" in MongoDB @@ -462,7 +461,7 @@ def update_time_school(): collection_archive.update_one( { "_id": ObjectId(array_document_archive_school_time_table)}, { "$set": { - "School Subject." + array_test[0] + "." + str(gagaga)+ ".Teacher": teacher, + "School Subject." + array_test[0] + "." + str(gagaga_teacher)+ ".Teacher": teacher, } } ) @@ -492,7 +491,7 @@ def update_time_school(): collection_archive.update_one( { "_id": ObjectId(array_document_archive_school_time_table)}, { "$set": { - "School Subject." + array_test[0] + "." + str(gagaga)+ ".Teacher": teacher, + "School Subject." + array_test[0] + "." + str(gagaga_teacher)+ ".Teacher": teacher, } } ) @@ -510,7 +509,6 @@ def update_time_school(): if check_repeat_room == 5: check_repeat_room = 0 dont_repeat_room = 0 - #number = 1 else: if day == "None": if room == 0: @@ -529,14 +527,14 @@ def update_time_school(): collection.update_one( { "_id": ObjectId(array_document_school_time_table)}, { "$set": { - "School Subject." + array_test[0] + "." + str(gagaga_teacher) + ".Room": room, + "School Subject." + array_test[0] + "." + str(gagaga_room) + ".Room": room, } } ) collection_archive.update_one( { "_id": ObjectId(array_document_archive_school_time_table)}, { "$set": { - "School Subject." + array_test[0] + "." + str(gagaga)+ ".Room": room, + "School Subject." + array_test[0] + "." + str(gagaga_room)+ ".Room": room, } } ) @@ -559,14 +557,14 @@ def update_time_school(): collection.update_one( { "_id": ObjectId(array_document_school_time_table)}, { "$set": { - "School Subject." + array_test[0] + "." + str(gagaga_teacher)+ ".Room": room, + "School Subject." + array_test[0] + "." + str(gagaga_room)+ ".Room": room, } } ) collection_archive.update_one( { "_id": ObjectId(array_document_archive_school_time_table)}, { "$set": { - "School Subject." + array_test[0] + "." + str(gagaga)+ ".Room": room, + "School Subject." + array_test[0] + "." + str(gagaga_room)+ ".Room": room, } } )