diff --git a/cogs/tasks.py b/cogs/tasks.py index 80ada4b..d161462 100644 --- a/cogs/tasks.py +++ b/cogs/tasks.py @@ -18,9 +18,13 @@ class Tasks(commands.Cog): # self.resetPoke.start() self.checkBirthdays.start() self.updateMessageCounts.start() + self.sendReminders.start() @tasks.loop(hours=1.0) async def bankInterest(self): + """ + Task that gives daily interest + """ # Don't do it multiple times a day if bot dc's, ... with open("files/lastTasks.json", "r") as fp: lastTasks = json.load(fp) @@ -58,6 +62,9 @@ class Tasks(commands.Cog): @tasks.loop(hours=1.0) async def resetLost(self): + """ + Task that resets Lost Today + """ # Don't do it multiple times a day if bot dc's, ... with open("files/lastTasks.json", "r") as fp: lastTasks = json.load(fp) @@ -79,6 +86,9 @@ class Tasks(commands.Cog): @tasks.loop(hours=6.0) async def resetPoke(self): + """ + Task that resets Poke + """ if int(time.time()) - int(poke.get()[1]) > 259200: await self.client.get_guild(int(self.client.constants.CallOfCode))\ .get_channel(int(self.client.constants.DidierPosting))\ @@ -90,6 +100,9 @@ class Tasks(commands.Cog): @tasks.loop(hours=1.0) async def resetPrison(self): + """ + Task that lowers prison time daily + """ # Don't do it multiple times a day if bot dc's, ... with open("files/lastTasks.json", "r") as fp: lastTasks = json.load(fp) @@ -107,6 +120,9 @@ class Tasks(commands.Cog): @tasks.loop(hours=1.0) async def checkBirthdays(self): + """ + Task that wishes people a happy birthday + """ # Don't do it multiple times a day if bot dc's, ... with open("files/lastTasks.json", "r") as fp: lastTasks = json.load(fp) @@ -138,6 +154,9 @@ class Tasks(commands.Cog): @tasks.loop(hours=1.0) async def updateMessageCounts(self): + """ + Task that updates the activity counter for channels + """ # Don't do it multiple times a day if bot dc's, ... with open("files/lastTasks.json", "r") as fp: lastTasks = json.load(fp) @@ -154,6 +173,21 @@ class Tasks(commands.Cog): async def beforeupdateMessageCounts(self): await self.client.wait_until_ready() + @tasks.loop(hours=1.0) + async def sendReminders(self): + """ + Task that sends people daily reminders + """ + # 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()) == 0 and int(time.time()) - int(lastTasks["remind"]) > 10000: + pass + + # with open("files/lastTasks.json", "w") as fp: + # lastTasks["remind"] = round(time.time()) + # json.dump(lastTasks, fp) + def getCurrentHour(self): return timeFormatters.dateTimeNow().hour diff --git a/ignored.md b/ignored.md index 503fe79..483e923 100644 --- a/ignored.md +++ b/ignored.md @@ -48,7 +48,8 @@ Contains timestamps for when every `task` in `cogs/tasks.py` ran for the last ti "interest": 0, "lost": 0, "prison": 0, - "poke": 0 + "poke": 0, + "remind": 0 } ```