From 03cdf7cf3b85c1eb6f452725648758eb4076de62 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Thu, 27 Dec 2018 14:13:28 +0300 Subject: [PATCH] Get rid of data folder on git, add it to gitignore, gen files needed at boot --- .gitignore | 4 ++-- Robocop.py | 11 +++++++++++ data/restrictions.json | 1 - data/warnsv2.json | 1 - 4 files changed, 13 insertions(+), 4 deletions(-) delete mode 100644 data/restrictions.json delete mode 100644 data/warnsv2.json diff --git a/.gitignore b/.gitignore index a4bcda6..aa7ee7b 100755 --- a/.gitignore +++ b/.gitignore @@ -100,5 +100,5 @@ files/* priv-* config.py -# Prevent new versions of this from being committed -data/warnsv2.json +# Prevent data files from being committed +data/ diff --git a/Robocop.py b/Robocop.py index 085191e..13e410f 100755 --- a/Robocop.py +++ b/Robocop.py @@ -167,4 +167,15 @@ async def on_message(message): ctx = await bot.get_context(message) await bot.invoke(ctx) +if not os.path.exists("data"): + os.makedirs("data") + +wanted_jsons = ["data/restrictions.json", + "data/warnsv2.json"] + +for wanted_json in wanted_jsons: + if not os.path.exists(wanted_json): + with open(wanted_json, "w") as f: + f.write("{}") + bot.run(config.token, bot=True, reconnect=True) diff --git a/data/restrictions.json b/data/restrictions.json deleted file mode 100644 index 0967ef4..0000000 --- a/data/restrictions.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/data/warnsv2.json b/data/warnsv2.json deleted file mode 100644 index 9e26dfe..0000000 --- a/data/warnsv2.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file