# -*- coding: utf-8 -*-
from modules.functions import jsonLoad, jsonSave
def locale(key, *args):
strings = jsonLoad("strings.json")
string = strings
for dict_key in args:
string = string[dict_key]
return string[key]
def configGet(key):
return jsonLoad("config.json")[key]
def configAppend(key, value):
config = jsonLoad("config.json")
config[key].append(value)
jsonSave("config.json", config)
def configRemove(key, value):
config[key].remove(value)
def userSet(userid, key, value):
user = jsonLoad(f"data/users/{userid}.json")
user[key] = value
jsonSave(f"data/users/{userid}.json", user)
def userGet(userid, key):
try:
return jsonLoad(f"data/users/{userid}.json")[key]
except KeyError:
return None
except FileNotFoundError:
def userClear(userid, key):
del user[key]
pass