Avoid scheduling reminders from reminders

master
Nikola Forró 4 years ago
parent fe6840f19c
commit d1c97376b7

@ -142,7 +142,8 @@ class Bot(discord.Client):
except YouTubeError as e:
return
published = entry.get('published')
if published and not entry.get('reminder'):
reminder = entry.get('reminder')
if published and not reminder:
if [v for v, p in self.yt_videos if v == video_id and p == published]:
return
self.yt_videos.append((video_id, published))
@ -153,6 +154,7 @@ class Bot(discord.Client):
scheduled_start = video.get('scheduled_start')
if scheduled_start:
remaining = (scheduled_start - datetime.datetime.now(datetime.timezone.utc)).total_seconds()
if not reminder:
for minutes in COUNTDOWN:
if remaining > minutes * 60:
payload = data.copy()

Loading…
Cancel
Save