From feef183cad0935f33fa0c8aef558038a091bd465 Mon Sep 17 00:00:00 2001 From: ennucore Date: Fri, 24 Jun 2022 20:06:50 +0300 Subject: [PATCH] Fix the timezone --- bot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index ec2ad35..2bd5683 100644 --- a/bot.py +++ b/bot.py @@ -15,6 +15,7 @@ import traceback import time +tz = datetime.timezone(datetime.timedelta(hours=3)) POLL_HOUR = 10 SCHEDULING_HOUR = 20 @@ -231,11 +232,11 @@ class Bot(telebot.TeleBot): def run_necessary_actions_for_community(self, community: Community): if community.task_last_timestamps.get('poll', datetime.date.today() - datetime.timedelta(days=1)) \ - < datetime.date.today() and datetime.datetime.now().hour >= POLL_HOUR: + < datetime.date.today() and datetime.datetime.now(tz).hour >= POLL_HOUR: self.poll_users_in_community(community) community.task_last_timestamps['poll'] = datetime.date.today() if community.task_last_timestamps.get('scheduling', datetime.date.today() - datetime.timedelta(days=1)) \ - < datetime.date.today() and datetime.datetime.now().hour >= SCHEDULING_HOUR: + < datetime.date.today() and datetime.datetime.now(tz).hour >= SCHEDULING_HOUR: community.schedule_meetings() self.send_meeting_info_in_community(community) community.task_last_timestamps['scheduling'] = datetime.date.today()