mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Backup settings on deletion (#163)
This commit is contained in:
parent
95b5096961
commit
4fb5ba75b4
8
red.py
8
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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user