1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-23 22:27:27 +00:00

Overrode on_error to close connections and open terminal with traceback

This commit is contained in:
Myned 2017-10-14 15:29:01 -04:00
parent 225bebff0a
commit b3435e3316

View file

@ -43,10 +43,21 @@ async def on_ready():
print('- - - - - - -')
@bot.event
async def on_error(error):
if u.session:
await u.session.close()
await bot.logout()
await bot.close()
print('- - - - - - -')
print('ERROR')
tb.print_exc()
@bot.event
async def on_command_error(ctx, error):
if not isinstance(error, commands.errors.CommandNotFound):
print(error)
tb.print_exception(type(error), error, error.__traceback__, file=sys.stderr)
await ctx.send('{}\n```\n{}```'.format(exc.base, error))