diff --git a/src/main/run.py b/src/main/run.py index 6de0b5f..93d72c9 100644 --- a/src/main/run.py +++ b/src/main/run.py @@ -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))