mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Debug timetable updater again
This commit is contained in:
parent
8ee61b662f
commit
fa7ccc78c2
1 changed files with 6 additions and 3 deletions
|
@ -15,6 +15,9 @@ def schedule_times():
|
|||
for h in range(24):
|
||||
for m in range(0, 60, 15):
|
||||
times.append(time(h, m, 0))
|
||||
print("[TimeTable Updater Task] Update times:")
|
||||
for _time in times:
|
||||
print("[TimeTable Updater Task] {0.hour}:{0.minute}".format(_time))
|
||||
return times
|
||||
|
||||
|
||||
|
@ -25,6 +28,9 @@ class TimeTableCog(commands.Cog):
|
|||
self.timetable = json.load(file)
|
||||
self.update_status.start()
|
||||
|
||||
def cog_unload(self):
|
||||
self.update_status.stop()
|
||||
|
||||
def are_on_break(self, date: datetime = None) -> Optional[Dict[str, Union[str, datetime]]]:
|
||||
"""Checks if the date is one as a term break"""
|
||||
date = date or datetime.now()
|
||||
|
@ -36,9 +42,6 @@ class TimeTableCog(commands.Cog):
|
|||
if date.timestamp() <= end_date.timestamp() and date.timestamp() >= start_date.timestamp():
|
||||
return {"name": name, "start": start_date, "end": end_date}
|
||||
|
||||
def cog_unload(self):
|
||||
self.update_status.stop()
|
||||
|
||||
def current_lesson(self, date: datetime = None) -> Optional[dict]:
|
||||
date = date or datetime.now()
|
||||
lessons = self.timetable.get(date.strftime("%A").lower(), [])
|
||||
|
|
Loading…
Reference in a new issue