mirror of https://github.com/stijndcl/didier
Fixed reminder & broken import
parent
6ddaa6e488
commit
1d0782bdc8
|
@ -202,6 +202,12 @@ class Tasks(commands.Cog):
|
||||||
if (not category["weekends"]) and weekday > 4:
|
if (not category["weekends"]) and weekday > 4:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Create embed once because this can be heavy
|
||||||
|
if "embed" in category:
|
||||||
|
embed = category["embed"]()
|
||||||
|
else:
|
||||||
|
embed = None
|
||||||
|
|
||||||
for user in category["users"]:
|
for user in category["users"]:
|
||||||
userInstance = self.client.get_user(user)
|
userInstance = self.client.get_user(user)
|
||||||
|
|
||||||
|
@ -213,7 +219,7 @@ class Tasks(commands.Cog):
|
||||||
if "embed" not in category:
|
if "embed" not in category:
|
||||||
await userInstance.send(random.choice(category["messages"]))
|
await userInstance.send(random.choice(category["messages"]))
|
||||||
else:
|
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:
|
with open("files/lastTasks.json", "w") as fp:
|
||||||
lastTasks["remind"] = round(time.time())
|
lastTasks["remind"] = round(time.time())
|
||||||
|
|
|
@ -13,7 +13,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": True}
|
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]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue