Fixed reminder & broken import

pull/85/head
Stijn De Clercq 2021-08-10 12:02:39 +02:00
parent 6ddaa6e488
commit 1d0782bdc8
3 changed files with 8 additions and 2 deletions

View File

@ -202,6 +202,12 @@ class Tasks(commands.Cog):
if (not category["weekends"]) and weekday > 4:
continue
# Create embed once because this can be heavy
if "embed" in category:
embed = category["embed"]()
else:
embed = None
for user in category["users"]:
userInstance = self.client.get_user(user)
@ -213,7 +219,7 @@ class Tasks(commands.Cog):
if "embed" not in category:
await userInstance.send(random.choice(category["messages"]))
else:
await userInstance.send(random.choice(category["messages"]), embed=category["embed"])
await userInstance.send(random.choice(category["messages"]), embed=embed)
with open("files/lastTasks.json", "w") as fp:
lastTasks["remind"] = round(time.time())

View File

@ -13,7 +13,7 @@ class Reminders:
self._les = [int(user[0]) for user in rows if user[2]]
self._lesMessages = ["Lessenrooster voor vandaag:"]
self.les = {"users": self._les, "messages": self._lesMessages, "embed": self.lesEmbed(), "weekends": False, "disabled": True}
self.les = {"users": self._les, "messages": self._lesMessages, "embed": self.lesEmbed, "weekends": False, "disabled": True}
self.categories = [self.nightly, self.les]