Wrap eval in async def
This commit is contained in:
parent
8fb9722d53
commit
0589a8902c
1 changed files with 3 additions and 5 deletions
|
@ -241,13 +241,11 @@ 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}```")
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue