mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
fix timestamp selection
This commit is contained in:
parent
b98651e77a
commit
3ebea2b289
1 changed files with 9 additions and 7 deletions
|
@ -1128,15 +1128,17 @@ class OtherCog(commands.Cog):
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
parsed_qs = parse_qs(url)
|
parsed_qs = parse_qs(url)
|
||||||
if "t" in parsed_qs and parsed_qs["t"] and parsed_qs["t"][0].isdigit():
|
if "t" in parsed_qs and parsed_qs['t']:
|
||||||
# Assume is timestamp
|
# Assume is timestamp
|
||||||
|
try:
|
||||||
|
timestamp, end_timestamp = map(round, map(float, parsed_qs["t"]))
|
||||||
|
if end_timestamp < timestamp:
|
||||||
|
timestamp, end_timestamp = reversed((timestamp, end_timestamp))
|
||||||
|
except ValueError:
|
||||||
timestamp = round(float(parsed_qs["t"][0]))
|
timestamp = round(float(parsed_qs["t"][0]))
|
||||||
end_timestamp = None
|
end_timestamp = None
|
||||||
if len(parsed_qs["t"]) >= 2:
|
|
||||||
end_timestamp = round(float(parsed_qs["t"][1]))
|
_end = "to %s" % end_timestamp if end_timestamp is not None else "onward"
|
||||||
if end_timestamp < timestamp:
|
|
||||||
end_timestamp, timestamp = reversed((end_timestamp, timestamp))
|
|
||||||
_end = "to %s" % end_timestamp if len(parsed_qs["t"]) == 2 else "onward"
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="Trimming...",
|
title="Trimming...",
|
||||||
description=f"Trimming from {timestamp} seconds {_end}.\nThis may take a while.",
|
description=f"Trimming from {timestamp} seconds {_end}.\nThis may take a while.",
|
||||||
|
|
Loading…
Reference in a new issue