Reminders work

This commit is contained in:
Stijn De Clercq 2020-10-23 22:12:05 +02:00
parent 6682327f1e
commit 95bdc576e1
4 changed files with 17 additions and 10 deletions

View file

@ -61,8 +61,7 @@ class School(commands.Cog):
# Add all the user's courses
def customizeSchedule(self, ctx, year, semester):
with open("files/schedules/{}{}.json".format(year, semester), "r") as fp:
schedule = json.load(fp)
schedule = les.getSchedule(semester, year)
member = self.client.get_guild(int(constants.CallOfCode)).get_member(ctx.author.id)
for role in member.roles:

View file

@ -5,7 +5,7 @@ from enums.numbers import Numbers
from functions import timeFormatters
from functions.database import currency, poke, prison, birthdays, stats
import json
from random import random
import random
import requests
import time
@ -183,7 +183,7 @@ class Tasks(commands.Cog):
# Don't do it multiple times a day if bot dc's, ...
with open("files/lastTasks.json", "r") as fp:
lastTasks = json.load(fp)
if int(self.getCurrentHour()) == 21 and int(time.time()) - int(lastTasks["remind"]) > 10000:
if int(self.getCurrentHour()) == 22 and int(time.time()) - int(lastTasks["remind"]) > 10000:
reminders = Reminders()
for category in reminders.categories:
@ -200,9 +200,9 @@ class Tasks(commands.Cog):
else:
await userInstance.send(random.choice(category["messages"]), embed=category["embed"])
# with open("files/lastTasks.json", "w") as fp:
# lastTasks["remind"] = round(time.time())
# json.dump(lastTasks, fp)
with open("files/lastTasks.json", "w") as fp:
lastTasks["remind"] = round(time.time())
json.dump(lastTasks, fp)
def getCurrentHour(self):
return timeFormatters.dateTimeNow().hour