diff --git a/cogs/school.py b/cogs/school.py index a12a919..52fd18d 100644 --- a/cogs/school.py +++ b/cogs/school.py @@ -43,41 +43,22 @@ class School(commands.Cog): @commands.check(checks.allowedChannels) @help.Category(category=Category.School) async def les(self, ctx, *day): - embed = discord.Embed(colour=discord.Colour.blue()) + parsed = les.parseArgs(day) - # These are hardcoded because they don't change & don't matter anymore in a month - embed.set_author(name="Examenrooster 2de Bachelor") + # Invalid arguments + if not parsed[0]: + return await ctx.send(parsed[1]) - embed.add_field(name="Algoritmen en Datastructuren 2", - value="Woensdag 06/01/2021\n13:00 - 16:00\nFlanders Expo, Hal 4D", inline=False) - embed.add_field(name="Functioneel Programmeren", - value="Dinsdag 12/01/2021\n13:00 - 16:00\nFlanders Expo, Hal 5C", inline=False) - embed.add_field(name="Systeemprogrammeren", - value="Maandag 18/01/2021\n08:30 - 11:30\nOnline, schriftelijk", inline=False) - embed.add_field(name="Communicatienetwerken", - value="Vrijdag 22/01/2021\n13:00 - 16:00\nFlanders Expo Hal 4A", inline=False) - embed.add_field(name="Statistiek en Probabiliteit", - value="Vrijdag 29/01/2021\n08:30 - 11:30\nCampus Ardoyen Locus, PC Resto Locus", inline=False) + day, dayDatetime, semester, year = parsed[1:] + + # Customize the user's schedule + schedule = self.customizeSchedule(ctx, year, semester) + + # Create the embed + embed = les.createEmbed(day, dayDatetime, semester, year, schedule) await ctx.send(embed=embed) - # Les code - # parsed = les.parseArgs(day) - # - # # Invalid arguments - # if not parsed[0]: - # return await ctx.send(parsed[1]) - # - # day, dayDatetime, semester, year = parsed[1:] - # - # # Customize the user's schedule - # schedule = self.customizeSchedule(ctx, year, semester) - # - # # Create the embed - # embed = les.createEmbed(day, dayDatetime, semester, year, schedule) - # - # await ctx.send(embed=embed) - # Add all the user's courses def customizeSchedule(self, ctx, year, semester): schedule = les.getSchedule(semester, year) diff --git a/files/config.json b/files/config.json index 670b336..dd9aec4 100644 --- a/files/config.json +++ b/files/config.json @@ -1 +1 @@ -{"semester": "1", "year": "2", "years": 2, "jpl": 161733, "jpl_day": 22} \ No newline at end of file +{"semester": "2", "year": "2", "years": 2, "jpl": 161733, "jpl_day": 24} \ No newline at end of file diff --git a/files/schedules/22.json b/files/schedules/22.json new file mode 100644 index 0000000..5ef090a --- /dev/null +++ b/files/schedules/22.json @@ -0,0 +1,84 @@ +[ + { + "course": "Computerarchitectuur", + "zoom": "https://ufora.ugent.be/d2l/ext/rp/228912/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", + "slots": [ + { + "online": "ZOOM", + "time": ["maandag", 1000, 1300] + }, + { + "online": "ZOOM", + "time": ["dinsdag", 830, 930] + }, + { + "online": "ZOOM", + "time": ["donderdag", 1430, 1700] + } + ] + }, + { + "course": "Multimedia", + "zoom": "https://ufora.ugent.be/d2l/ext/rp/236949/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", + "slots": [ + { + "online": "ZOOM", + "time": ["maandag", 1430, 1730] + }, + { + "campus": "Sterre", + "building": "S9", + "room": "A3", + "time": ["woensdag", 1130, 1330] + } + ] + }, + { + "course": "Wetenschappelijk Rekenen", + "zoom": "https://ufora.ugent.be/d2l/ext/rp/236404/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", + "slots": [ + { + "online": "ZOOM", + "time": ["dinsdag", 1130, 1300] + }, + { + "online": "ZOOM", + "time": ["woensdag", 1500, 1800] + }, + { + "online": "ZOOM", + "time": ["donderdag", 830, 1000] + } + ] + }, + { + "course": "Software Engineering Lab 1", + "zoom": "https://ufora.ugent.be/d2l/ext/rp/235800/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", + "slots": [ + { + "online": "ZOOM", + "time": ["dinsdag", 1430, 1700] + }, + { + "online": "ZOOM", + "time": ["vrijdag", 830, 1130] + } + ] + }, + { + "course": "Webdevelopment", + "zoom": "https://ufora.ugent.be/d2l/ext/rp/223449/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826", + "slots": [ + { + "campus": "Sterre", + "building": "S9", + "room": "A3", + "time": ["woensdag", 900, 1100] + }, + { + "online": "ZOOM", + "time": ["donderdag", 1000, 1300] + } + ] + } +] \ No newline at end of file diff --git a/functions/les.py b/functions/les.py index c8b4229..9b6b558 100644 --- a/functions/les.py +++ b/functions/les.py @@ -21,7 +21,7 @@ def createCourseString(courses): def createEmbed(day, dayDatetime, semester, year, schedule): # Create a date object to check the current week - startDate = 1600041600 + startDate = 1612224000 currentTime = dayDatetime.timestamp() week = clamp(timeFormatters.timeIn(currentTime - startDate, "weeks")[0], 1, 13) @@ -47,12 +47,11 @@ def createEmbed(day, dayDatetime, semester, year, schedule): if extras: embed.add_field(name="Extra", value="\n".join(getExtras(extra) for extra in extras), inline=False) - # TODO uncomment this when covid rules slow down # Add online links - temporarily removed because everything is online right now - # if online: - # uniqueLinks: dict = getUniqueLinks(online) - # embed.add_field(name="Online Links", value="\n".join( - # sorted(getLinks(onlineClass, links) for onlineClass, links in uniqueLinks.items()))) + if online: + uniqueLinks: dict = getUniqueLinks(online) + embed.add_field(name="Online Links", value="\n".join( + sorted(getLinks(onlineClass, links) for onlineClass, links in uniqueLinks.items()))) embed.set_footer(text="Semester {} | Lesweek {}".format(semester, round(week))) return embed