From 8fb9722d53c15ecea96b2cd050eeda398f19eaba Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 27 Jun 2021 19:32:25 -0600 Subject: [PATCH] Add await to eval --- jarvis/cogs/dev.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jarvis/cogs/dev.py b/jarvis/cogs/dev.py index c4c41b3..b900bd6 100644 --- a/jarvis/cogs/dev.py +++ b/jarvis/cogs/dev.py @@ -238,16 +238,17 @@ class DevCog(commands.Cog): output = subprocess.check_output(["cloc", "."]).decode("UTF-8") await ctx.send(f"```\n{output}\n```") - @commands.is_owner() @commands.command(name="eval") + @commands.is_owner() async def _eval(self, ctx, *, code: str): try: output = eval(code, locals(), globals()) except Exception: output = traceback.format_exc() if inspect.isawaitable(output): - output = await output - await ctx.send(f"```{output}```") + await ctx.send(f"```{await output}```") + else: + await ctx.send(f"```{output}```") def setup(bot):