mirror of
https://github.com/Ryujinx/ryuko-ng.git
synced 2024-12-23 06:25:33 +00:00
Rename warnsv2.json to userlog.py
This commit is contained in:
parent
03cdf7cf3b
commit
91dd17e967
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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])
|
||||
|
|
Loading…
Reference in a new issue