|
|
|
@ -142,7 +142,7 @@ class Bot(discord.Client):
|
|
|
|
|
except YouTubeError as e:
|
|
|
|
|
return
|
|
|
|
|
published = entry.get('published')
|
|
|
|
|
if published:
|
|
|
|
|
if published and not entry.get('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))
|
|
|
|
@ -155,7 +155,9 @@ class Bot(discord.Client):
|
|
|
|
|
remaining = (scheduled_start - datetime.datetime.now(datetime.timezone.utc)).total_seconds()
|
|
|
|
|
for minutes in COUNTDOWN:
|
|
|
|
|
if remaining > minutes * 60:
|
|
|
|
|
Timer.schedule(scheduled_start - datetime.timedelta(minutes=minutes), data)
|
|
|
|
|
payload = data.copy()
|
|
|
|
|
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))
|
|
|
|
|
mention = channel.guild.default_role.mention
|
|
|
|
|
await channel.send('{mention} {note}**{title}**\n{link}'.format(mention=mention, note=note, **video))
|
|
|
|
|