🃏 Created blackjack game

This commit is contained in:
NikolajDanger
2020-07-28 01:58:04 +02:00
parent 5c31877656
commit 3db053be12
69 changed files with 530 additions and 24 deletions

View File

@ -6,8 +6,8 @@ from . import money
from funcs import logThis
def triviaStart(channel : str):
with open("resources/games.json", "r") as f:
triviaFile = json.load(f)
with open("resources/games/games.json", "r") as f:
triviaFile = json.load(f)
logThis("Trying to find a trivia question for "+channel)
@ -22,7 +22,7 @@ def triviaStart(channel : str):
correctAnswer = answers.index(data["results"][0]["correct_answer"]) + 97
triviaFile["trivia questions"][channel] = {"answer" : str(chr(correctAnswer)),"players" : {}}
with open("resources/games.json", "w") as f:
with open("resources/games/games.json", "w") as f:
json.dump(triviaFile,f,indent=4)
replacements = {"'": "\'",
@ -45,7 +45,7 @@ def triviaStart(channel : str):
return "There's already a trivia question going on. Try again in like, a minute", "", ""
def triviaOtherThing(user : str, channel : str, command : str):
with open("resources/games.json", "r") as f:
with open("resources/games/games.json", "r") as f:
data = json.load(f)
if command in ["a","b","c","d"]:
@ -55,7 +55,7 @@ def triviaOtherThing(user : str, channel : str, command : str):
data["trivia questions"][channel]["players"][user] = command
with open("resources/games.json", "w") as f:
with open("resources/games/games.json", "w") as f:
json.dump(data,f,indent=4)
return "Locked in "+user+"'s answer"
@ -67,7 +67,7 @@ def triviaOtherThing(user : str, channel : str, command : str):
return "I didn't quite understand that"
def triviaCountPoints(channel : str):
with open("resources/games.json", "r") as f:
with open("resources/games/games.json", "r") as f:
data = json.load(f)
logThis("Counting points for question in "+channel)