From ea753beda1957edbae598dc9ece5b45cb03d807a Mon Sep 17 00:00:00 2001 From: profitroll Date: Wed, 19 Apr 2023 10:31:25 +0200 Subject: [PATCH] This commit closes #37 --- config_example.json | 1 + modules/scheduled.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config_example.json b/config_example.json index 0b3e093..6042585 100644 --- a/config_example.json +++ b/config_example.json @@ -64,6 +64,7 @@ }, "sponsorships": { "time": 9, + "grayout_days": 2, "enabled": true }, "cache_avatars": { diff --git a/modules/scheduled.py b/modules/scheduled.py index 244ab1b..c375064 100644 --- a/modules/scheduled.py +++ b/modules/scheduled.py @@ -133,7 +133,7 @@ if configGet("enabled", "features", "sponsorships") is True: ) async def check_sponsors(): for entry in col_sponsorships.find( - {"sponsorship.expires": {"$lt": datetime.now() + timedelta(days=2)}} + {"sponsorship.expires": {"$lt": datetime.now() + timedelta(days=3)}} ): try: if entry["user"] not in jsonLoad( @@ -159,7 +159,14 @@ if configGet("enabled", "features", "sponsorships") is True: ) continue for entry in col_sponsorships.find( - {"sponsorship.expires": {"$lt": datetime.now() - timedelta(days=1)}} + { + "sponsorship.expires": { + "$lt": datetime.now() + - timedelta( + days=configGet("grayout_days", "scheduler", "sponsorships") + ) + } + } ): try: holo_user = HoloUser(entry["user"])