Browse Source

Fix the timezone

master
Lev 2 years ago
parent
commit
feef183cad
  1. 5
      bot.py

5
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()

Loading…
Cancel
Save