This commit is contained in:
NikolajDanger
2020-08-07 11:18:24 +02:00
parent b45aac1d1c
commit e0e74f5bc0
2 changed files with 15 additions and 15 deletions

View File

@ -132,14 +132,14 @@ def drawImage(channel):
startx -= placeGridSize[0]*3 + 90 startx -= placeGridSize[0]*3 + 90
starty -= gridBorder + 60 starty -= gridBorder + 60
mask = winBar.copy()#.convert("L") mask = winBar.copy()#.convert("L")
#mask.putalpha(128) #mask.putalpha(128)
#mask.save("test.png") #mask.save("test.png")
winBarImage = Image.new("RGBA",mask.size,color=winBarColor) winBarImage = Image.new("RGBA",mask.size,color=winBarColor)
background.paste(winBarImage,(startx,starty),mask) background.paste(winBarImage,(startx,starty),mask)
# Bottom # Bottom
textPadding = 20 textPadding = 20

View File

@ -168,10 +168,10 @@ def makeFiles():
for path, content in data["json"].items(): for path, content in data["json"].items():
makeJsonFile(path,content) makeJsonFile(path,content)
for path, content in data["txt"].items(): for path, content in data["txt"].items():
makeTxtFile(path,content) makeTxtFile(path,content)
for path in data["folder"]: for path in data["folder"]:
makeFolder(path) makeFolder(path)
@ -183,7 +183,7 @@ def replaceMultiple(mainString, toBeReplaces, newString):
if elem in mainString : if elem in mainString :
# Replace the string # Replace the string
mainString = mainString.replace(elem, newString) mainString = mainString.replace(elem, newString)
return mainString return mainString
def emojiToCommand(emoji): def emojiToCommand(emoji):
@ -236,27 +236,27 @@ def monopolyReactionTest(channel,message):
def stopServer(): def stopServer():
with open("resources/games/games.json","r") as f: with open("resources/games/games.json","r") as f:
games = json.load(f) games = json.load(f)
games["trivia questions"] = {} games["trivia questions"] = {}
games["blackjack games"] = {} games["blackjack games"] = {}
games["4 in a row games"] = {} games["4 in a row games"] = {}
with open("resources/games/games.json","w") as f: with open("resources/games/games.json","w") as f:
json.dump(games,f,indent=4) json.dump(games,f,indent=4)
emptyDict = {} emptyDict = {}
with open("resources/games/monopolyGames.json", "w") as f: with open("resources/games/monopolyGames.json", "w") as f:
json.dump(emptyDict,f,indent=4) json.dump(emptyDict,f,indent=4)
with open("resources/games/hexGames.json", "w") as f: with open("resources/games/hexGames.json", "w") as f:
json.dump(emptyDict,f,indent=4) json.dump(emptyDict,f,indent=4)
def deleteGame(gameType,channel): def deleteGame(gameType,channel):
with open("resources/games/games.json", "r") as f: with open("resources/games/games.json", "r") as f:
data = json.load(f) data = json.load(f)
del data[gameType][channel] del data[gameType][channel]
with open("resources/games/games.json", "w") as f: with open("resources/games/games.json", "w") as f:
json.dump(data,f,indent=4) json.dump(data,f,indent=4)
@ -264,7 +264,7 @@ def deleteGame(gameType,channel):
def addToDict(userID,userName): def addToDict(userID,userName):
with open("resources/users.json", "r") as f: with open("resources/users.json", "r") as f:
data = json.load(f) data = json.load(f)
if userID in data: if userID in data:
if data[userID]["user name"] != userName: if data[userID]["user name"] != userName:
logThis("changing name for "+userName) logThis("changing name for "+userName)
@ -306,14 +306,14 @@ def getID(userName):
try: try:
with open("resources/users.json", "r") as f: with open("resources/users.json", "r") as f:
data = json.load(f) data = json.load(f)
userID = None userID = None
for key, value in data.items(): for key, value in data.items():
if userName.lower() == value["user name"].lower(): if userName.lower() == value["user name"].lower():
userID = key userID = key
break break
return userID return userID
except: except:
logThis("Error getting ID") logThis("Error getting ID")