1
0
Fork 0
mirror of synced 2024-05-17 19:12:33 +12:00

Handle exceptions being over 2000 characters

This commit is contained in:
phxntxm 2019-02-14 18:35:53 -06:00
parent 73bb685d1c
commit 6e2ab01cbf

View file

@ -173,7 +173,7 @@ class Owner:
ret = await func() ret = await func()
except Exception: except Exception:
value = stdout.getvalue() value = stdout.getvalue()
await ctx.send('```py\n{}{}\n```'.format(value, traceback.format_exc())) await ctx.send(f"```py\n{value}{traceback.format_exc()}\n```"[:2000])
else: else:
value = stdout.getvalue() value = stdout.getvalue()
try: try:
@ -181,15 +181,12 @@ class Owner:
except Exception: except Exception:
pass pass
try: if ret is None:
if ret is None: if value:
if value: await ctx.send(f"```py\n{value}\n```"[:2000])
await ctx.send('```py\n%s\n```' % value) else:
else: self._last_result = ret
self._last_result = ret await ctx.send(f"```py\n{value}{ret}\n```"[:2000])
await ctx.send('```py\n%s%s\n```' % (value, ret))
except discord.HTTPException:
await ctx.send("Content too large for me to print!")
@commands.command() @commands.command()
async def bash(self, ctx, *, cmd: str): async def bash(self, ctx, *, cmd: str):