From 0589a8902c1d9f0ded13b7735bae5363300ceafc Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 27 Jun 2021 19:34:27 -0600 Subject: [PATCH] Wrap eval in async def --- jarvis/cogs/dev.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/jarvis/cogs/dev.py b/jarvis/cogs/dev.py index b900bd6..9ab06be 100644 --- a/jarvis/cogs/dev.py +++ b/jarvis/cogs/dev.py @@ -241,14 +241,12 @@ class DevCog(commands.Cog): @commands.command(name="eval") @commands.is_owner() async def _eval(self, ctx, *, code: str): + code = f"async def fn():{code}" try: - output = eval(code, locals(), globals()) + output = exec(code, globals(), locals()) except Exception: output = traceback.format_exc() - if inspect.isawaitable(output): - await ctx.send(f"```{await output}```") - else: - await ctx.send(f"```{output}```") + await ctx.send(f"```{output}```") def setup(bot):