1
0
Fork 0
mirror of synced 2024-05-03 04:02:28 +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()
except Exception:
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:
value = stdout.getvalue()
try:
@ -181,15 +181,12 @@ class Owner:
except Exception:
pass
try:
if ret is None:
if value:
await ctx.send('```py\n%s\n```' % value)
else:
self._last_result = ret
await ctx.send('```py\n%s%s\n```' % (value, ret))
except discord.HTTPException:
await ctx.send("Content too large for me to print!")
if ret is None:
if value:
await ctx.send(f"```py\n{value}\n```"[:2000])
else:
self._last_result = ret
await ctx.send(f"```py\n{value}{ret}\n```"[:2000])
@commands.command()
async def bash(self, ctx, *, cmd: str):