🥅 Error codes
This commit is contained in:
@ -265,8 +265,8 @@ def charData(user : str,cmd : str):
|
||||
logThis("Returning a list of weapons")
|
||||
return ", ".join(list(data[user][key]))
|
||||
else:
|
||||
logThis("The character doesn't have any weapons. Which is probably for the best. Like, who just walks around with weapons?")
|
||||
return "There doesn't seem to be anything there..."
|
||||
logThis("The character doesn't have any weapons. Which is probably for the best. Like, who just walks around with weapons? (error code 941)")
|
||||
return "There doesn't seem to be anything there... (error code 941)"
|
||||
else:
|
||||
return setUpDict(data[user][key])
|
||||
elif cmd[0] == "+":
|
||||
@ -276,8 +276,8 @@ def charData(user : str,cmd : str):
|
||||
while cmd[0] == ' ':
|
||||
cmd = cmd[1:]
|
||||
except:
|
||||
logThis("Nope. That didn't happen")
|
||||
return "Can't do that"
|
||||
logThis("Nope. That didn't happen (error code 942)")
|
||||
return "Can't do that (error code 942)"
|
||||
|
||||
if (key == "Talents" or key == "Force-powers") and "," in cmd:
|
||||
cmd = cmd.split(",")
|
||||
@ -297,8 +297,8 @@ def charData(user : str,cmd : str):
|
||||
try:
|
||||
data[user][key][cmd[0]] = int(cmd[1])
|
||||
except:
|
||||
logThis("Fucked that up")
|
||||
return "Wrong data type"
|
||||
logThis("Fucked that up (error code 949)")
|
||||
return "Wrong data type (error code 949)"
|
||||
with open("resources/swcharacters.json", "w") as f:
|
||||
json.dump(data,f,indent = 4)
|
||||
return cmd[0]+" added to "+key+" for " + data[user]["Name"]
|
||||
@ -315,8 +315,8 @@ def charData(user : str,cmd : str):
|
||||
return cmd+" added to weapons for " + data[user]["Name"]
|
||||
|
||||
else:
|
||||
logThis("That's not happening")
|
||||
return "Can't add that"
|
||||
logThis("That's not happening (error code 947d)")
|
||||
return "Can't add that (error code 947d)"
|
||||
|
||||
elif cmd[0] == "-":
|
||||
logThis("Gonna subtract/remove something")
|
||||
@ -325,8 +325,8 @@ def charData(user : str,cmd : str):
|
||||
while cmd[0] == ' ':
|
||||
cmd = cmd[1:]
|
||||
except:
|
||||
logThis("AAAAAAAAAAAA")
|
||||
return "Can't do that"
|
||||
logThis("AAAAAAAAAAAA (error code 948)")
|
||||
return "Can't do that (error code 948)"
|
||||
|
||||
if key == "Talents" or key == "Force-powers" or key == "Weapons" or key == "Obligations":
|
||||
logThis("Trying to remove "+cmd+" from "+key)
|
||||
@ -337,11 +337,11 @@ def charData(user : str,cmd : str):
|
||||
logThis("I did that")
|
||||
return cmd+" removed from "+key+" from "+data[user]["Name"]
|
||||
else:
|
||||
logThis("Welp. I fucked that up")
|
||||
return "Can't remove that"
|
||||
logThis("Welp. I fucked that up (error code 946e)")
|
||||
return "Can't remove that (error code 946e)"
|
||||
else:
|
||||
logThis("Urgh!")
|
||||
return "Can't remove that"
|
||||
logThis("Urgh! (error code 946d)")
|
||||
return "Can't remove that (error code 946d)"
|
||||
|
||||
else:
|
||||
logThis("Looking up "+cmd+" in "+key)
|
||||
@ -375,8 +375,8 @@ def charData(user : str,cmd : str):
|
||||
while cmd[0] == ' ':
|
||||
cmd = cmd[1:]
|
||||
except:
|
||||
logThis("Error message")
|
||||
return "Can't do that"
|
||||
logThis("Error message (error code 948)")
|
||||
return "Can't do that (error code 948)"
|
||||
|
||||
if type(data[user][key]) is int:
|
||||
try:
|
||||
@ -387,8 +387,8 @@ def charData(user : str,cmd : str):
|
||||
json.dump(data,f,indent = 4)
|
||||
return "Added " + cmd + " to " + data[user]["Name"] + "'s " + key
|
||||
except:
|
||||
logThis("BITCH SANDWICH")
|
||||
return "Can't add that"
|
||||
logThis("BITCH SANDWICH (error code 947c)")
|
||||
return "Can't add that (error code 947c)"
|
||||
elif type(data[user][key]) is list:
|
||||
try:
|
||||
logThis("Adding "+cmd+" to "+key)
|
||||
@ -397,11 +397,11 @@ def charData(user : str,cmd : str):
|
||||
json.dump(data,f,indent = 4)
|
||||
return "Added " + cmd + " to " + data[user]["Name"] + "'s " + key
|
||||
except:
|
||||
logThis("tstststststs")
|
||||
return "Can't add that"
|
||||
logThis("tstststststs (error code 947b)")
|
||||
return "Can't add that (error code 947b)"
|
||||
else:
|
||||
logThis("Help")
|
||||
return "Can't add that"
|
||||
logThis("Help (error code 947a)")
|
||||
return "Can't add that (error code 947a)"
|
||||
elif cmd[0] == '-':
|
||||
logThis("Removing/subtracting")
|
||||
try:
|
||||
@ -409,8 +409,8 @@ def charData(user : str,cmd : str):
|
||||
while cmd[0] == ' ':
|
||||
cmd = cmd[1:]
|
||||
except:
|
||||
logThis("lalalala")
|
||||
return "Can't do that"
|
||||
logThis("lalalala (error code 948)")
|
||||
return "Can't do that (error code 948)"
|
||||
|
||||
if type(data[user][key]) is int:
|
||||
try:
|
||||
@ -421,8 +421,8 @@ def charData(user : str,cmd : str):
|
||||
json.dump(data,f,indent = 4)
|
||||
return "Subtracted " + cmd + " from " + data[user]["Name"] + "'s " + key
|
||||
except:
|
||||
logThis("Tried it. Didn't want to")
|
||||
return "Can't remove that"
|
||||
logThis("Tried it. Didn't want to (error code 946c)")
|
||||
return "Can't remove that (error code 946c)"
|
||||
elif type(data[user][key]) is list:
|
||||
try:
|
||||
logThis("removing "+cmd+" from "+key)
|
||||
@ -431,38 +431,39 @@ def charData(user : str,cmd : str):
|
||||
data[user][key].remove(cmd)
|
||||
except:
|
||||
logThis("They can only remove stuff that's actually in the list")
|
||||
return "Not in list"
|
||||
return "Not in list (error code 944b)"
|
||||
with open("resources/swcharacters.json", "w") as f:
|
||||
json.dump(data,f,indent = 4)
|
||||
return "Removed " + cmd + " from " + data[user]["Name"] + "'s " + key
|
||||
except:
|
||||
logThis("nah")
|
||||
return "Can't remove that"
|
||||
logThis("nah (error code 946b)")
|
||||
return "Can't remove that (error code 946b)"
|
||||
else:
|
||||
logThis("nyope")
|
||||
return "Can't remove that"
|
||||
logThis("nyope (error code 946a)")
|
||||
return "Can't remove that (error code 946a)"
|
||||
else:
|
||||
logThis("Changing "+key+" to "+cmd)
|
||||
if type(data[user][key]) is int:
|
||||
try:
|
||||
data[user][key] = int(cmd)
|
||||
except:
|
||||
return "Can't do that"
|
||||
logThis("I don't wanna tho (error code 945b)")
|
||||
return "Can't do that (error code 945b)"
|
||||
elif type(data[user][key]) is str:
|
||||
data[user][key] = cmd
|
||||
else:
|
||||
logThis("I don't wanna tho")
|
||||
return "Can't do that"
|
||||
logThis("I don't wanna tho (error code 945a)")
|
||||
return "Can't do that (error code 945a)"
|
||||
|
||||
with open("resources/swcharacters.json", "w") as f:
|
||||
json.dump(data,f,indent = 4)
|
||||
return "Changed " + data[user]["Name"] + "'s " + key +" to " + cmd
|
||||
else:
|
||||
logThis(key+" isn't in there")
|
||||
return "Couldn't find that data. Are you sure you spelled it correctly?"
|
||||
logThis(key+" isn't in there (error code 944)")
|
||||
return "Couldn't find that data. Are you sure you spelled it correctly? (error code 944)"
|
||||
else:
|
||||
logThis(user+" doesn't have a character")
|
||||
return "You don't have a character. You can make one with !swchar"
|
||||
logThis(user+" doesn't have a character (error code 943)")
|
||||
return "You don't have a character. You can make one with !swchar (error code 943)"
|
||||
|
||||
def replaceSpaces(cmd : str):
|
||||
withSpaces = ["Specialization Trees","Wound Threshold","Strain Threshold","Defense - Ranged","Defense - Melee","Force Rating","Core Worlds","Outer Rim","Piloting - Planetary","Piloting - Space","Ranged - Heavy","Ranged - Light","Lightsaber Characteristic","Critical Injuries","Force Powers"]
|
||||
|
@ -59,8 +59,8 @@ def parseDestiny(user : str, cmd : str):
|
||||
if len(commands) > 1:
|
||||
return destinyNew(int(commands[1]))
|
||||
else:
|
||||
return "You need to give an amount of players"
|
||||
return "You need to give an amount of players (error code 921)"
|
||||
elif commands[0] == "U":
|
||||
return destinyUse(user)
|
||||
else:
|
||||
return "I didn't quite understand that"
|
||||
return "I didn't quite understand that (error code 922)"
|
||||
|
@ -304,7 +304,11 @@ def parseRoll(user : str,cmd : str = ""):
|
||||
rollParameters = [0,0,0,0,0,0,0]
|
||||
|
||||
if string.capwords(commands[0]) == "Obligations":
|
||||
return obligationRoll()
|
||||
try:
|
||||
return obligationRoll()
|
||||
except:
|
||||
logThis("Obligation fucked up (error code 911)")
|
||||
return "An error occured (error code 911)"
|
||||
|
||||
elif string.capwords(commands[0]) in skillData:
|
||||
logThis("Oh look! This guy has skills!")
|
||||
@ -324,15 +328,15 @@ def parseRoll(user : str,cmd : str = ""):
|
||||
commands = [str(abilityDice)] + [str(proficiencyDice)] + commands[1:]
|
||||
logThis("Converted skill to dice")
|
||||
else:
|
||||
logThis("Okay, no they don't i guess")
|
||||
return "You don't have a user. You can make one with !swchar"
|
||||
logThis("Okay, no they don't i guess (error code 912)")
|
||||
return "You don't have a user. You can make one with !swchar (error code 912)"
|
||||
|
||||
elif string.capwords(commands[0]) in ["Ranged","Piloting"]:
|
||||
logThis("They fucked up writing the name of a ranged or piloting skill")
|
||||
if string.capwords(commands[0]) == "Ranged":
|
||||
return "Did you mean \"Ranged - Heavy\" or \"Ranged - Light\""
|
||||
return "Did you mean \"Ranged - Heavy\" or \"Ranged - Light\" (error code 913)"
|
||||
else:
|
||||
return "Did you mean \"Piloting - Planetary\" or \"Piloting - Space\""
|
||||
return "Did you mean \"Piloting - Planetary\" or \"Piloting - Space\" (error code 913)"
|
||||
|
||||
try:
|
||||
logThis("Converting commands to dice")
|
||||
@ -356,8 +360,8 @@ def parseRoll(user : str,cmd : str = ""):
|
||||
else:
|
||||
rollParameters[x] = int(commands[x])
|
||||
except:
|
||||
logThis("Someone fucked u-up! (it was them)")
|
||||
return "Invalid input!"
|
||||
logThis("Someone fucked u-up! (it was them) (error code 914)")
|
||||
return "Invalid input! (error code 914)"
|
||||
|
||||
logThis("Rolling "+str(rollParameters))
|
||||
rollResults, diceResults = roll(rollParameters[0],rollParameters[1],rollParameters[2],rollParameters[3],rollParameters[4],rollParameters[5],rollParameters[6])
|
||||
|
Reference in New Issue
Block a user