|
|
@ -142,7 +142,8 @@ class Bot(discord.Client):
|
|
|
|
except YouTubeError as e:
|
|
|
|
except YouTubeError as e:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
published = entry.get('published')
|
|
|
|
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]:
|
|
|
|
if [v for v, p in self.yt_videos if v == video_id and p == published]:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
self.yt_videos.append((video_id, published))
|
|
|
|
self.yt_videos.append((video_id, published))
|
|
|
@ -153,11 +154,12 @@ class Bot(discord.Client):
|
|
|
|
scheduled_start = video.get('scheduled_start')
|
|
|
|
scheduled_start = video.get('scheduled_start')
|
|
|
|
if scheduled_start:
|
|
|
|
if scheduled_start:
|
|
|
|
remaining = (scheduled_start - datetime.datetime.now(datetime.timezone.utc)).total_seconds()
|
|
|
|
remaining = (scheduled_start - datetime.datetime.now(datetime.timezone.utc)).total_seconds()
|
|
|
|
for minutes in COUNTDOWN:
|
|
|
|
if not reminder:
|
|
|
|
if remaining > minutes * 60:
|
|
|
|
for minutes in COUNTDOWN:
|
|
|
|
payload = data.copy()
|
|
|
|
if remaining > minutes * 60:
|
|
|
|
payload['feed']['entry']['reminder'] = '{0}m'.format(minutes)
|
|
|
|
payload = data.copy()
|
|
|
|
Timer.schedule(scheduled_start - datetime.timedelta(minutes=minutes), payload)
|
|
|
|
payload['feed']['entry']['reminder'] = '{0}m'.format(minutes)
|
|
|
|
|
|
|
|
Timer.schedule(scheduled_start - datetime.timedelta(minutes=minutes), payload)
|
|
|
|
note = 'Live in {0} minutes!\n'.format(int(remaining / 60))
|
|
|
|
note = 'Live in {0} minutes!\n'.format(int(remaining / 60))
|
|
|
|
mention = channel.guild.default_role.mention
|
|
|
|
mention = channel.guild.default_role.mention
|
|
|
|
await channel.send('{mention} {note}**{title}**\n{link}'.format(mention=mention, note=note, **video))
|
|
|
|
await channel.send('{mention} {note}**{title}**\n{link}'.format(mention=mention, note=note, **video))
|
|
|
|