📝 Commenting and formatting
This commit is contained in:
@ -2,6 +2,7 @@ import json
|
||||
|
||||
from funcs import logThis
|
||||
|
||||
# Returns the account balance for a user
|
||||
def checkBalance(user):
|
||||
user = user.lower()
|
||||
logThis("checking "+user+"'s account balance")
|
||||
@ -12,6 +13,7 @@ def checkBalance(user):
|
||||
return data["users"][user]
|
||||
else: return 0
|
||||
|
||||
# Adds money to the account of a user
|
||||
def addMoney(user,amount):
|
||||
user = user.lower()
|
||||
logThis("adding "+str(amount)+" to "+user+"'s account")
|
||||
@ -27,6 +29,7 @@ def addMoney(user,amount):
|
||||
with open("resources/games/games.json", "w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
# Transfers money from one user to another
|
||||
def giveMoney(user,targetUser,amount):
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
@ -35,7 +38,7 @@ def giveMoney(user,targetUser,amount):
|
||||
if data["users"][user] >= amount:
|
||||
addMoney(user,-1 * amount)
|
||||
addMoney(targetUser,amount)
|
||||
return "Transferred the GwendoBucks"
|
||||
return "Transferred "+str(amount)+" GwendoBucks to "+user
|
||||
else:
|
||||
logThis("They didn't have enough GwendoBucks")
|
||||
return "You don't have that many GwendoBucks"
|
||||
|
Reference in New Issue
Block a user