mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Added discord timestamps (#6264)
Co-authored-by: palmtree5 <3577255+palmtree5@users.noreply.github.com>
This commit is contained in:
parent
24afd61a85
commit
f8d6bbb0af
@ -221,17 +221,16 @@ class YoutubeStream(Stream):
|
|||||||
if vid_data["liveStreamingDetails"].get("scheduledStartTime", None) is not None:
|
if vid_data["liveStreamingDetails"].get("scheduledStartTime", None) is not None:
|
||||||
if "actualStartTime" not in vid_data["liveStreamingDetails"]:
|
if "actualStartTime" not in vid_data["liveStreamingDetails"]:
|
||||||
start_time = parse_time(vid_data["liveStreamingDetails"]["scheduledStartTime"])
|
start_time = parse_time(vid_data["liveStreamingDetails"]["scheduledStartTime"])
|
||||||
|
start_time_unix = time.mktime(start_time.timetuple())
|
||||||
start_in = start_time - datetime.now(timezone.utc)
|
start_in = start_time - datetime.now(timezone.utc)
|
||||||
if start_in.total_seconds() > 0:
|
if start_in.total_seconds() > 0:
|
||||||
embed.description = _("This stream will start in {time}").format(
|
embed.description = _("This stream will start <t:{time}:R>").format(
|
||||||
time=humanize_timedelta(
|
time=int(start_time_unix)
|
||||||
timedelta=timedelta(minutes=start_in.total_seconds() // 60)
|
|
||||||
) # getting rid of seconds
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
embed.description = _(
|
embed.description = _("This stream was scheduled for <t:{time}:R>").format(
|
||||||
"This stream was scheduled for {min} minutes ago"
|
time=int(start_time_unix)
|
||||||
).format(min=round((start_in.total_seconds() * -1) // 60))
|
)
|
||||||
embed.timestamp = start_time
|
embed.timestamp = start_time
|
||||||
is_schedule = True
|
is_schedule = True
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user