Init commit
This commit is contained in:
20
swchar.py
Normal file
20
swchar.py
Normal file
@ -0,0 +1,20 @@
|
||||
import json
|
||||
|
||||
def charData(user : str, key : str,cmd : str = ""):
|
||||
with open("characters.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if user in data:
|
||||
if key in data[user]:
|
||||
if cmd == "":
|
||||
return data[user][key]
|
||||
else:
|
||||
data[user]["Name"] = cmd
|
||||
with open("characters.json", "w") as f:
|
||||
json.dump(data,f,indent = 4)
|
||||
return "Changed " + user + "'s character's name to " + cmd
|
||||
else:
|
||||
return "Couldn't find that data. Are you sure you spelled it correctly?"
|
||||
else:
|
||||
return "You don't have a character. You can make one with !swchar"
|
||||
|
Reference in New Issue
Block a user