🐛 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

@ -1,4 +1,4 @@
from .miscFuncs import helloFunc, cap, imageFunc, logThis, findWikiPage, makeFiles, replaceMultiple, emojiToNumber, fiarReactionTest
from .miscFuncs import helloFunc, cap, imageFunc, logThis, findWikiPage, makeFiles, replaceMultiple, emojiToNumber, fiarReactionTest, deleteGame, stopServer
from .swfuncs import *

View File

@ -254,4 +254,23 @@ def fiarReactionTest(channel,message,user):
logThis("It wasn't their turn")
return False, 0
else:
return False, 0
return False, 0
def stopServer():
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)
def deleteGame(gameType,channel):
with open("resources/games/games.json", "r") as f:
data = json.load(f)
del data[gameType][channel]
with open("resources/games/games.json", "w") as f:
json.dump(data,f,indent=4)