diff options
-rw-r--r-- | bc_funcs/misc.bc | 12 | ||||
-rwxr-xr-x | cogs/utils.py | 7 |
2 files changed, 3 insertions, 16 deletions
diff --git a/bc_funcs/misc.bc b/bc_funcs/misc.bc deleted file mode 100644 index a768397..0000000 --- a/bc_funcs/misc.bc +++ /dev/null @@ -1,12 +0,0 @@ -define void findseed() { - auto x, i, s - s = scale - scale = 0 - - for (i = 0; i < 12; i++) - if (rand() % 10 < 1) - x += 1 - - scale = s - print "Your seed is a ", x, " eye" -} 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): |