aboutsummaryrefslogtreecommitdiff
path: root/cogs
diff options
context:
space:
mode:
authorMango0x45 <thomasvoss@live.com>2020-08-25 19:51:01 +0000
committerMango0x45 <thomasvoss@live.com>2020-08-25 19:51:01 +0000
commitf5d9865ce97321e27c4c48db516ce847df8a3555 (patch)
tree3432b6054b28bdf34792a2bf0038c41b91495423 /cogs
parent437fc6a0c7072fc58d9f59c7e6b632ede6db9bfe (diff)
downloadsteve-bot-f5d9865ce97321e27c4c48db516ce847df8a3555.tar
steve-bot-f5d9865ce97321e27c4c48db516ce847df8a3555.tar.gz
steve-bot-f5d9865ce97321e27c4c48db516ce847df8a3555.tar.bz2
steve-bot-f5d9865ce97321e27c4c48db516ce847df8a3555.tar.lz
steve-bot-f5d9865ce97321e27c4c48db516ce847df8a3555.tar.xz
steve-bot-f5d9865ce97321e27c4c48db516ce847df8a3555.tar.zst
steve-bot-f5d9865ce97321e27c4c48db516ce847df8a3555.zip
Added retime command (WARNING: BAD CODEgit add cogs/utils.py git add cogs/utils.py )
Diffstat (limited to 'cogs')
-rwxr-xr-xcogs/utils.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/cogs/utils.py b/cogs/utils.py
index c6d6902..9bff27b 100755
--- a/cogs/utils.py
+++ b/cogs/utils.py
@@ -384,6 +384,33 @@ class Utils(commands.Cog):
output = ", ".join([*commands])
await ctx.send(f"```List of custom commands:\n{output}```")
+ @commands.command()
+ async def retime(self, ctx, start_sec, end_sec, frames, framerate):
+ """Retimes a run using the start/end timestamps, leftover frames, and framerate"""
+ if start_sec.count(':') == 2:
+ start_sec = sum(
+ x * int(t)
+ for x, t in zip([3600, 60, 1], start_sec.split(":")))
+ elif start_sec.count(':') == 1:
+ start_sec = sum(x * int(t)
+ for x, t in zip([60, 1], start_sec.split(":")))
+ else:
+ start_sec = int(start_sec)
+
+ if end_sec.count(':') == 2:
+ end_sec = sum(x * int(t)
+ for x, t in zip([3600, 60, 1], end_sec.split(":")))
+ elif end_sec.count(':') == 1:
+ end_sec = sum(x * int(t)
+ for x, t in zip([60, 1], end_sec.split(":")))
+ else:
+ end_sec = int(end_sec)
+
+ await ctx.send(
+ str(
+ timedelta(seconds=end_sec - start_sec +
+ round((frames / framerate), 3))).replace('000', ''))
+
def setup(bot):
bot.add_cog(Utils(bot))