Fix timezone-naive datetime

master
Nikola Forró 4 years ago
parent f50f6c708e
commit 8ca86f2234

@ -146,7 +146,7 @@ class Bot(discord.Client):
if video.get('live_broadcast') == 'upcoming': if video.get('live_broadcast') == 'upcoming':
scheduled_start = video.get('scheduled_start') scheduled_start = video.get('scheduled_start')
if scheduled_start: if scheduled_start:
remaining = (scheduled_start - datetime.datetime.utcnow()).total_seconds() remaining = (scheduled_start - datetime.datetime.now(datetime.timezone.utc)).total_seconds()
for minutes in COUNTDOWN: for minutes in COUNTDOWN:
if remaining > minutes * 60: if remaining > minutes * 60:
Timer.schedule(scheduled_start - datetime.timedelta(minutes=minutes), data) Timer.schedule(scheduled_start - datetime.timedelta(minutes=minutes), data)

Loading…
Cancel
Save