mirror of https://github.com/stijndcl/didier
Compare commits
2 Commits
c1169b4496
...
56a2880b31
Author | SHA1 | Date |
---|---|---|
Stijn De Clercq | 56a2880b31 | |
Stijn De Clercq | f655748025 |
|
@ -1,3 +1,5 @@
|
||||||
|
import random
|
||||||
|
|
||||||
from data import constants
|
from data import constants
|
||||||
from decorators import help
|
from decorators import help
|
||||||
import discord
|
import discord
|
||||||
|
@ -43,21 +45,25 @@ class School(commands.Cog):
|
||||||
# @commands.check(checks.allowedChannels)
|
# @commands.check(checks.allowedChannels)
|
||||||
@help.Category(category=Category.School)
|
@help.Category(category=Category.School)
|
||||||
async def les(self, ctx, *day):
|
async def les(self, ctx, *day):
|
||||||
parsed = les.parseArgs(day)
|
deadlines = ["SEL", "Webdevelopment", "Computerarchitectuur", "Wetenschappelijk Rekenen"]
|
||||||
|
|
||||||
# Invalid arguments
|
await ctx.send("'T is vakantie. Sort of. Werk een beetje aan uw project voor {}.".format(random.choice(deadlines)))
|
||||||
if not parsed[0]:
|
#
|
||||||
return await ctx.send(parsed[1])
|
# parsed = les.parseArgs(day)
|
||||||
|
#
|
||||||
day, dayDatetime, semester, year = parsed[1:]
|
# # Invalid arguments
|
||||||
|
# if not parsed[0]:
|
||||||
# Customize the user's schedule
|
# return await ctx.send(parsed[1])
|
||||||
schedule = self.customizeSchedule(ctx, year, semester)
|
#
|
||||||
|
# day, dayDatetime, semester, year = parsed[1:]
|
||||||
# Create the embed
|
#
|
||||||
embed = les.createEmbed(day, dayDatetime, semester, year, schedule)
|
# # Customize the user's schedule
|
||||||
|
# schedule = self.customizeSchedule(ctx, year, semester)
|
||||||
await ctx.send(embed=embed)
|
#
|
||||||
|
# # Create the embed
|
||||||
|
# embed = les.createEmbed(day, dayDatetime, semester, year, schedule)
|
||||||
|
#
|
||||||
|
# await ctx.send(embed=embed)
|
||||||
|
|
||||||
# Add all the user's courses
|
# Add all the user's courses
|
||||||
def customizeSchedule(self, ctx, year, semester):
|
def customizeSchedule(self, ctx, year, semester):
|
||||||
|
|
|
@ -245,6 +245,10 @@ class Tasks(commands.Cog):
|
||||||
"""
|
"""
|
||||||
Task that checks for new Ufora announcements every few minutes
|
Task that checks for new Ufora announcements every few minutes
|
||||||
"""
|
"""
|
||||||
|
# Don't run this when testing
|
||||||
|
if self.client.user.id == int(constants.coolerDidierId):
|
||||||
|
return
|
||||||
|
|
||||||
# Get new notifications
|
# Get new notifications
|
||||||
announcements = ufora_notifications.run()
|
announcements = ufora_notifications.run()
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Reminders:
|
||||||
|
|
||||||
self._les = [int(user[0]) for user in rows if user[2]]
|
self._les = [int(user[0]) for user in rows if user[2]]
|
||||||
self._lesMessages = ["Lessenrooster voor vandaag:"]
|
self._lesMessages = ["Lessenrooster voor vandaag:"]
|
||||||
self.les = {"users": self._les, "messages": self._lesMessages, "embed": self.lesEmbed(), "weekends": False, "disabled": False}
|
self.les = {"users": self._les, "messages": self._lesMessages, "embed": self.lesEmbed(), "weekends": False, "disabled": True}
|
||||||
|
|
||||||
self.categories = [self.nightly, self.les]
|
self.categories = [self.nightly, self.les]
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,15 @@ def createEmbed(day, dayDatetime, semester, year, schedule):
|
||||||
# Create a date object to check the current week
|
# Create a date object to check the current week
|
||||||
startDate = 1612224000
|
startDate = 1612224000
|
||||||
currentTime = dayDatetime.timestamp()
|
currentTime = dayDatetime.timestamp()
|
||||||
|
|
||||||
week = clamp(timeFormatters.timeIn(currentTime - startDate, "weeks")[0], 1, 13)
|
week = clamp(timeFormatters.timeIn(currentTime - startDate, "weeks")[0], 1, 13)
|
||||||
|
|
||||||
|
# Compensate for easter holidays
|
||||||
|
# Sorry but I don't have time to make a clean solution for this rn
|
||||||
|
# this will have to do
|
||||||
|
if currentTime > 1617377400:
|
||||||
|
week -= 2
|
||||||
|
|
||||||
title, week = getTitle(day, dayDatetime, week)
|
title, week = getTitle(day, dayDatetime, week)
|
||||||
|
|
||||||
# Add all courses & their corresponding times + locations of today
|
# Add all courses & their corresponding times + locations of today
|
||||||
|
|
Loading…
Reference in New Issue