mirror of https://github.com/stijndcl/didier
Create remind task, add docstring comments, update ignored.md
parent
fbc9bbe820
commit
caf595010b
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue