From e339595b3170f70c4c03a0dbea78b9894b8e3eab Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Sat, 30 Apr 2016 17:21:30 +0000 Subject: retry --- bot.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'bot.py') diff --git a/bot.py b/bot.py index d573dba..c3b860d 100755 --- a/bot.py +++ b/bot.py @@ -302,18 +302,21 @@ ensure_future(run_video()) loop = get_event_loop() loop.set_debug(True) -try: - loop.run_until_complete(client.start(config['username'], config['password'])) -except KeyboardInterrupt: - import time - die = True - - logger.info('shutting down') - time.sleep(1.2) - - with suppress(discord.errors.ClientException): - loop.run_until_complete(client.logout()) - loop.stop() -finally: - loop.close() + +while True: + try: + loop.run_until_complete(client.start(config['username'], config['password'])) + except KeyboardInterrupt: + import time + die = True + + logger.info('shutting down') + time.sleep(1.2) + + with suppress(discord.errors.ClientException): + loop.run_until_complete(client.logout()) + loop.stop() + loop.close() + except Exception: + logger.exception() -- cgit v1.3.1