Modify exec

release-1.0.0
DustyP 8 years ago
parent 8a68823f82
commit 0d45b8b827

@ -37,6 +37,7 @@ class Repl:
async def _eval(self, ctx, *, body: str):
if ctx.author.id != ownerid:
return
pag = Paginator()
env = {
'bot': self.bot,
'ctx': ctx,
@ -60,8 +61,10 @@ class Repl:
with redirect_stdout(stdout):
ret = await func()
except Exception:
value = stdout.getvalue()
await ctx.send('```py\n{}{}\n```'.format(value, traceback.format_exc()))
pag.add(stdout.getvalue())
pag.add(traceback.format_exc())
for page in pag.pages():
await ctx.send(page)
else:
value = stdout.getvalue()
# noinspection PyBroadException
@ -70,9 +73,9 @@ class Repl:
except Exception:
pass
value = format_output(value)
pag = Paginator()
pag.add(value)
pag.add(f'\nReturned: {ret}')
self._last_result = ret
for page in pag.pages():
await ctx.send(page)

Loading…
Cancel
Save