Skip to content

Commit

Permalink
Added discord timestamps (#6264)
Browse files Browse the repository at this point in the history
Co-authored-by: palmtree5 <3577255+palmtree5@users.noreply.github.com>
  • Loading branch information
giplgwm and palmtree5 committed Apr 4, 2024
1 parent 24afd61 commit f8d6bbb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions redbot/cogs/streams/streamtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,16 @@ async def make_embed(self, data):
if vid_data["liveStreamingDetails"].get("scheduledStartTime", None) is not None:
if "actualStartTime" not in vid_data["liveStreamingDetails"]:
start_time = parse_time(vid_data["liveStreamingDetails"]["scheduledStartTime"])
start_time_unix = time.mktime(start_time.timetuple())
start_in = start_time - datetime.now(timezone.utc)
if start_in.total_seconds() > 0:
embed.description = _("This stream will start in {time}").format(
time=humanize_timedelta(
timedelta=timedelta(minutes=start_in.total_seconds() // 60)
) # getting rid of seconds
embed.description = _("This stream will start <t:{time}:R>").format(
time=int(start_time_unix)
)
else:
embed.description = _(
"This stream was scheduled for {min} minutes ago"
).format(min=round((start_in.total_seconds() * -1) // 60))
embed.description = _("This stream was scheduled for <t:{time}:R>").format(
time=int(start_time_unix)
)
embed.timestamp = start_time
is_schedule = True
else:
Expand Down

0 comments on commit f8d6bbb

Please sign in to comment.