diff options
| author | Nathan Perry <nathan@meta.sc> | 2016-04-30 13:21:30 -0400 |
|---|---|---|
| committer | Nathan Perry <nathan@meta.sc> | 2016-04-30 13:21:30 -0400 |
| commit | e339595b3170f70c4c03a0dbea78b9894b8e3eab (patch) | |
| tree | afd18968ebe8c8e8b803ad7787ccdd03d10c5e84 | |
| parent | b5cf5bfaf4f56719dd0755a3c93f4ab768231173 (diff) | |
retry
| -rwxr-xr-x | bot.py | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -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) +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() -finally: - loop.close() + with suppress(discord.errors.ClientException): + loop.run_until_complete(client.logout()) + loop.stop() + loop.close() + except Exception: + logger.exception() |
