aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMango0x45 <thomasvoss@live.com>2021-01-03 13:26:47 +0000
committerMango0x45 <thomasvoss@live.com>2021-01-03 13:26:47 +0000
commit70a99a590e55603bdd7425c0f51942dbd4e2a5da (patch)
tree5e5bf9bba5a139813958c5d08a616eb16c558ee0
parent74881aa0401b5c918cec19924b55a9c032c09c06 (diff)
downloadsteve-bot-70a99a590e55603bdd7425c0f51942dbd4e2a5da.tar
steve-bot-70a99a590e55603bdd7425c0f51942dbd4e2a5da.tar.gz
steve-bot-70a99a590e55603bdd7425c0f51942dbd4e2a5da.tar.bz2
steve-bot-70a99a590e55603bdd7425c0f51942dbd4e2a5da.tar.lz
steve-bot-70a99a590e55603bdd7425c0f51942dbd4e2a5da.tar.xz
steve-bot-70a99a590e55603bdd7425c0f51942dbd4e2a5da.tar.zst
steve-bot-70a99a590e55603bdd7425c0f51942dbd4e2a5da.zip
Add math command with BC
-rwxr-xr-xcogs/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/cogs/utils.py b/cogs/utils.py
index 373b340..6ce4944 100755
--- a/cogs/utils.py
+++ b/cogs/utils.py
@@ -2,6 +2,7 @@ import asyncio
import datetime
import functools
import json
+import subprocess
from collections import namedtuple
from datetime import timedelta
# forgot to import this and ended up looking mentally unstable
@@ -431,6 +432,15 @@ class Utils(commands.Cog):
output = ", ".join([*commands])
await ctx.send(f"```List of custom commands:\n{output}```")
+ @commands.command(aliases=["calc"])
+ async def math(self, ctx, eqn):
+ try:
+ result = subprocess.check_output(f"echo '{eqn}' | bc", shell=True)
+ await ctx.send(result.decode("utf-8").strip())
+ except subprocess.CalledProcessError as err:
+ print(err)
+ await ctx.send("Something went wrong")
+
@commands.command()
async def retime(self, ctx, start_sec, end_sec, frames=0, framerate=30):
"""Retimes a run using the start/end timestamps, leftover frames, and framerate"""