diff --git a/app.py b/app.py index 451eaa0..d58a4c4 100644 --- a/app.py +++ b/app.py @@ -713,7 +713,9 @@ async def lastcleanup(ctx): return last_run_dt_utc = datetime.datetime.fromisoformat(last_run) - last_run_local = pytz.utc.localize(last_run_dt_utc).astimezone(LOCAL_TZ) + if last_run_dt_utc.tzinfo is None: + last_run_dt_utc = pytz.utc.localize(last_run_dt_utc) + last_run_local = last_run_dt_utc.astimezone(LOCAL_TZ) now_local = datetime.datetime.now(LOCAL_TZ) next_run_local = last_run_local + datetime.timedelta(hours=24) time_remaining = next_run_local - now_local @@ -1115,7 +1117,9 @@ async def on_ready(): # parse UTC timestamp from DB last_run_dt_utc = datetime.datetime.fromisoformat(last_run) # convert to local timezone - last_run_local = pytz.utc.localize(last_run_dt_utc).astimezone(LOCAL_TZ) + if last_run_dt_utc.tzinfo is None: + last_run_dt_utc = pytz.utc.localize(last_run_dt_utc) + last_run_local = last_run_dt_utc.astimezone(LOCAL_TZ) now_local = datetime.datetime.now(LOCAL_TZ) delta = now_local - last_run_local if delta.total_seconds() >= 24 * 3600: diff --git a/requirements.txt b/requirements.txt index 51e6f6e..44f0823 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,6 @@ discord.py==2.3.2 requests==2.32.3 mysql-connector-python==9.0.0 -python-dotenv==1.0.1 \ No newline at end of file +python-dotenv==1.0.1 +pytz==2025.2 +apscheduler==3.11.0 \ No newline at end of file