aboutsummaryrefslogtreecommitdiff
path: root/cogs
diff options
context:
space:
mode:
authorMango0x45 <thomasvoss@live.com>2021-01-05 08:44:08 +0000
committerMango0x45 <thomasvoss@live.com>2021-01-05 08:44:08 +0000
commitdc18f554af70be5918f8516771122bcc732e952b (patch)
tree4644ed4891cc58f11daff0551bd461dc6be10988 /cogs
parentad64d47483b9ea91408f6a8e32933129c28bba94 (diff)
downloadsteve-bot-dc18f554af70be5918f8516771122bcc732e952b.tar
steve-bot-dc18f554af70be5918f8516771122bcc732e952b.tar.gz
steve-bot-dc18f554af70be5918f8516771122bcc732e952b.tar.bz2
steve-bot-dc18f554af70be5918f8516771122bcc732e952b.tar.lz
steve-bot-dc18f554af70be5918f8516771122bcc732e952b.tar.xz
steve-bot-dc18f554af70be5918f8516771122bcc732e952b.tar.zst
steve-bot-dc18f554af70be5918f8516771122bcc732e952b.zip
Fix dumb issues and use GNU Bc
Diffstat (limited to 'cogs')
-rwxr-xr-xcogs/utils.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/cogs/utils.py b/cogs/utils.py
index f302dae..5c0536b 100755
--- a/cogs/utils.py
+++ b/cogs/utils.py
@@ -41,11 +41,11 @@ async def bc_calc(ctx, eqn: str):
with open("temp.txt", "w") as f:
f.write(eqn)
-
result = subprocess.check_output(
- f"echo 'scale=20; $(cat temp.txt)' | bc bc_funcs/*", shell=True
+ f'echo "scale=20; $(cat temp.txt)" | /bin/bc bc_funcs/*', shell=True
)
os.remove("temp.txt")
+
await ctx.send(result.decode("utf-8").replace("\\\n", "").strip())
except subprocess.CalledProcessError as err:
print(err)
@@ -571,8 +571,7 @@ class Utils(commands.Cog):
@commands.command(aliases=["calc"])
async def math(self, ctx, *, eqn: str):
# 10 second timeout
- await bc_calc(ctx, eqn)
- # await asyncio.wait_for(bc_calc(ctx, eqn), 10)
+ await asyncio.wait_for(bc_calc(ctx, eqn), 10)
@commands.command()
async def retime(self, ctx, start_sec, end_sec, frames=0, framerate=30):