From 4fb5ba75b4bef5ae9e76ce5a2474d63cde520405 Mon Sep 17 00:00:00 2001 From: tekulvw Date: Sat, 16 Apr 2016 16:30:17 -0400 Subject: [PATCH] Backup settings on deletion (#163) --- red.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/red.py b/red.py index 7fbc991e1..a2f6b5c4b 100644 --- a/red.py +++ b/red.py @@ -13,6 +13,8 @@ import sys import logging import aiohttp import importlib +import shutil +import traceback # # Red, a Discord bot by Twentysix, based on discord.py and its command extension @@ -528,10 +530,12 @@ if __name__ == '__main__': try: loop.run_until_complete(main()) except discord.LoginFailure: + traceback.print_exc() print("Invalid login credentials. Restart Red and configure it properly.") + shutil.copy('data/red/settings.json', 'data/red/settings.json-{}'.format(int(time.time()))) os.remove('data/red/settings.json') # Hopefully this won't backfire in case of discord servers' problems - except Exception as e: - print(e) + except: + traceback.print_exc() loop.run_until_complete(bot.logout()) finally: loop.close()