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