From fd72d34e48ba42ff46bacb5f6df15e557e1b8fe2 Mon Sep 17 00:00:00 2001 From: profitroll Date: Thu, 30 May 2024 23:18:58 +0200 Subject: [PATCH] pytz.utc instead of datetime.timezone.utc --- plugins/commands/set_offset.py | 7 ++++--- plugins/commands/upcoming.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/commands/set_offset.py b/plugins/commands/set_offset.py index 697c7ea..4fd2557 100644 --- a/plugins/commands/set_offset.py +++ b/plugins/commands/set_offset.py @@ -1,6 +1,7 @@ import logging -from datetime import datetime, timezone +from datetime import datetime +import pytz from convopyro import listen_message from pyrogram import filters from pyrogram.types import ForceReply, Message, ReplyKeyboardRemove @@ -65,9 +66,9 @@ async def command_set_offset(app: PyroClient, message: Message): logger.info("User %s has set offset to %s", user.id, offset) garbage_time = ( - datetime.now(timezone.utc) + datetime.now(pytz.utc) .replace(hour=user.time_hour, minute=user.time_minute) - .astimezone(user.location.timezone or timezone.utc) + .astimezone(user.location.timezone or pytz.utc) ) await answer.reply_text( diff --git a/plugins/commands/upcoming.py b/plugins/commands/upcoming.py index 881958d..e34e79c 100644 --- a/plugins/commands/upcoming.py +++ b/plugins/commands/upcoming.py @@ -1,5 +1,6 @@ -from datetime import datetime, timedelta, timezone +from datetime import datetime, timedelta +import pytz from pyrogram import filters from pyrogram.types import Message @@ -23,11 +24,11 @@ async def command_upcoming(app: PyroClient, message: Message): date_min = ( datetime.now(user.location.timezone).replace(second=0, microsecond=0) - ).replace(tzinfo=timezone.utc) + ).replace(tzinfo=pytz.utc) date_max = ( datetime.now(user.location.timezone).replace(second=0, microsecond=0) + timedelta(days=30) - ).replace(tzinfo=timezone.utc) + ).replace(tzinfo=pytz.utc) entries = [ await GarbageEntry.from_record(entry)