From 91dd17e967e215e2a096ba3216f96a1f00f47b00 Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Thu, 27 Dec 2018 14:19:33 +0300 Subject: [PATCH] Rename warnsv2.json to userlog.py --- README.md | 2 ++ Robocop.py | 2 +- helpers/userlogs.py | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a2903b8..7ffce16 100755 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ Code is based on https://gitlab.com/ao/dpybotbase and https://github.com/916253/ To keep the bot running, you might want to use pm2 or a systemd service. +If you're moving from Kurisu/Robocop, you'll want to copy your `data` folder over. Make sure to rename your `warnsv2.json` file to `userlog.json`. + --- ## TODO diff --git a/Robocop.py b/Robocop.py index 13e410f..c19aec0 100755 --- a/Robocop.py +++ b/Robocop.py @@ -171,7 +171,7 @@ if not os.path.exists("data"): os.makedirs("data") wanted_jsons = ["data/restrictions.json", - "data/warnsv2.json"] + "data/userlog.json"] for wanted_json in wanted_jsons: if not os.path.exists(wanted_json): diff --git a/helpers/userlogs.py b/helpers/userlogs.py index ee34132..50bce0a 100644 --- a/helpers/userlogs.py +++ b/helpers/userlogs.py @@ -9,17 +9,17 @@ userlog_event_types = {"warns": "Warn", def get_userlog(): - with open("data/warnsv2.json", "r") as f: + with open("data/userlog.json", "r") as f: return json.load(f) def set_userlog(contents): - with open("data/warnsv2.json", "w") as f: + with open("data/userlog.json", "w") as f: f.write(contents) def userlog(uid, issuer, reason, event_type, uname: str = ""): - with open("data/warnsv2.json", "r") as f: + with open("data/userlog.json", "r") as f: userlogs = json.load(f) uid = str(uid) if uid not in userlogs: @@ -40,6 +40,6 @@ def userlog(uid, issuer, reason, event_type, uname: str = ""): if event_type not in userlogs[uid]: userlogs[uid][event_type] = [] userlogs[uid][event_type].append(log_data) - with open("data/warnsv2.json", "w") as f: + with open("data/userlog.json", "w") as f: json.dump(userlogs, f) return len(userlogs[uid][event_type])