🃏 Created blackjack game
This commit is contained in:
@ -3,7 +3,9 @@ import json
|
||||
from funcs import logThis
|
||||
|
||||
def checkBalance(user):
|
||||
with open("resources/games.json", "r") as f:
|
||||
user = user.lower()
|
||||
logThis("checking "+user+"'s account balance")
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if user in data["users"]:
|
||||
@ -11,7 +13,9 @@ def checkBalance(user):
|
||||
else: return 0
|
||||
|
||||
def addMoney(user,amount):
|
||||
with open("resources/games.json", "r") as f:
|
||||
user = user.lower()
|
||||
logThis("adding "+str(amount)+" to "+user+"'s account")
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if user in data["users"]:
|
||||
@ -20,11 +24,11 @@ def addMoney(user,amount):
|
||||
else:
|
||||
data["users"][user] = amount
|
||||
|
||||
with open("resources/games.json", "w") as f:
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
def giveMoney(user,targetUser,amount):
|
||||
with open("resources/games.json", "r") as f:
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if user in data["users"]:
|
||||
|
Reference in New Issue
Block a user