summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Perry <nathan@meta.sc>2016-04-30 13:21:30 -0400
committerNathan Perry <nathan@meta.sc>2016-04-30 13:21:30 -0400
commite339595b3170f70c4c03a0dbea78b9894b8e3eab (patch)
treeafd18968ebe8c8e8b803ad7787ccdd03d10c5e84
parentb5cf5bfaf4f56719dd0755a3c93f4ab768231173 (diff)
retry
-rwxr-xr-xbot.py27
1 files changed, 15 insertions, 12 deletions
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)
+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()