From f363beb71215837ebea6770e63b9c1d57a81a865 Mon Sep 17 00:00:00 2001 From: Stijn De Clercq Date: Sat, 24 Oct 2020 00:11:57 +0200 Subject: [PATCH] Only send shedules during weekdays --- cogs/tasks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cogs/tasks.py b/cogs/tasks.py index 064dae3..888bdc0 100644 --- a/cogs/tasks.py +++ b/cogs/tasks.py @@ -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()) == 7 and int(time.time()) - int(lastTasks["remind"]) > 10000: + if self.getCurrentWeekday() < 5 and int(self.getCurrentHour()) == 7 and int(time.time()) - int(lastTasks["remind"]) > 10000: reminders = Reminders() for category in reminders.categories: @@ -211,6 +211,9 @@ class Tasks(commands.Cog): def getCurrentHour(self): return timeFormatters.dateTimeNow().hour + def getCurrentWeekday(self): + return timeFormatters.dateTimeNow().weekday() + def getCurrentBitcoinPrice(self): result = requests.get("https://api.coindesk.com/v1/bpi/currentprice.json").json() currentPrice = result["bpi"]["EUR"]["rate_float"]