mirror of
https://github.com/myned/modufur.git
synced 2024-12-24 22:27:28 +00:00
Overrode on_error to close connections and open terminal with traceback
This commit is contained in:
parent
225bebff0a
commit
b3435e3316
1 changed files with 12 additions and 1 deletions
|
@ -43,10 +43,21 @@ async def on_ready():
|
||||||
print('- - - - - - -')
|
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
|
@bot.event
|
||||||
async def on_command_error(ctx, error):
|
async def on_command_error(ctx, error):
|
||||||
if not isinstance(error, commands.errors.CommandNotFound):
|
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))
|
await ctx.send('{}\n```\n{}```'.format(exc.base, error))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue