🐛 games.json isn't written in await funcs

This commit is contained in:
NikolajDanger
2020-08-02 22:20:00 +02:00
parent b8628d2eb5
commit 3070213562
3 changed files with 24 additions and 23 deletions

View File

@ -87,16 +87,11 @@ async def fiar(channel,command,user):
winner = data["4 in a row games"][str(channel)]["winner"]
if winner != 0:
with open("resources/games/games.json","w") as f:
json.dump(data,f,indent=4)
addMoney(data["4 in a row games"][str(channel)]["players"][winner-1].lower(),20)
with open("resources/games/games.json", "r") as f:
data = json.load(f)
del data["4 in a row games"][str(channel)]
with open("resources/games/games.json","w") as f:
json.dump(data,f,indent=4)
deleteGame("4 in a row games",str(channel))
# Deletes a message
async def deleteMessage(imageLocation,channel):
@ -189,15 +184,7 @@ async def parseCommands(message,content):
if message.author.display_name == "Nikolaj":
await message.channel.send("Logging out...")
with open("resources/games/games.json","r") as f:
data = json.load(f)
data["trivia questions"] = {}
data["blackjack games"] = {}
data["4 in a row games"] = {}
with open("resources/games/games.json","w") as f:
json.dump(data,f,indent=4)
stopServer()
await client.logout()
else:
@ -441,12 +428,7 @@ async def parseCommands(message,content):
triviaCountPoints(str(message.channel))
with open("resources/games/games.json", "r") as f:
data = json.load(f)
del data["trivia questions"][str(message.channel)]
with open("resources/games/games.json", "w") as f:
json.dump(data,f,indent=4)
deleteGame("trivia questions",str(message.channel))
logThis("Time's up for the trivia question",str(message.channel))
await message.channel.send("Time's up The answer was \""+chr(correctAnswer)+") "+answers[correctAnswer-97]+"\". Anyone who answered that has gotten 1 GwendoBuck")