🗃️ UserID's instead of display names

This commit is contained in:
Nikolaj Danger
2020-08-04 16:59:13 +02:00
parent 4bcc8cbf59
commit 2ea11eb51f
11 changed files with 201 additions and 111 deletions

View File

@ -5,7 +5,7 @@ import datetime
from shutil import copyfile
from funcs import logThis, replaceMultiple
from funcs import logThis, replaceMultiple, getName
from . import money, blackjackDraw
# Shuffles the blackjack cards
@ -352,7 +352,7 @@ def blackjackDouble(channel,user,handNumber = 0):
roundDone = False
return "Adding another "+str(bet)+" GwendoBucks to "+user+"'s bet and drawing another card.",str(roundDone)[0] + str(data["blackjack games"][channel]["round"])
return "Adding another "+str(bet)+" GwendoBucks to "+getName(user)+"'s bet and drawing another card.",str(roundDone)[0] + str(data["blackjack games"][channel]["round"])
else:
logThis(user+" doesn't have enough GwendoBucks")
return "You don't have enough GwendoBucks",""
@ -544,7 +544,7 @@ def blackjackSplit(channel,user,handNumber = 0):
if person["fourth hand"]["hit"] == False and person["fourth hand"]["standing"] == False:
roundDone = False
return "Splitting "+user+"'s hand into 2. Adding their original bet to the second hand. You can use \"!Blackjack hit/stand/double 1\" and \"!Blackjack hit/stand/double 2\" to play the different hands.",str(roundDone)[0] + str(data["blackjack games"][channel]["round"])
return "Splitting "+getName(user)+"'s hand into 2. Adding their original bet to the second hand. You can use \"!Blackjack hit/stand/double 1\" and \"!Blackjack hit/stand/double 2\" to play the different hands.",str(roundDone)[0] + str(data["blackjack games"][channel]["round"])
else:
logThis(user+" doesn't have enough GwendoBucks")
return "You don't have enough GwendoBucks",""
@ -572,7 +572,7 @@ def blackjackPlayerDrawHand(channel,user,bet):
with open("resources/games/games.json", "r") as f:
data = json.load(f)
logThis(user+" is trying to join the game in "+channel)
logThis(getName(user)+" is trying to join the game in "+channel)
if channel in data["blackjack games"]:
if user not in data["blackjack games"][channel]["user hands"]:
@ -600,8 +600,8 @@ def blackjackPlayerDrawHand(channel,user,bet):
with open("resources/games/games.json", "w") as f:
json.dump(data,f,indent=4)
logThis(user+" entered the game")
return user+" entered the game"
logThis(getName(user)+" entered the game")
return getName(user)+" entered the game"
else:
logThis(user+" doesn't have enough GwendoBucks")
return "You don't have enough GwendoBucks to place that bet"
@ -669,14 +669,14 @@ def blackjackFinish(channel):
if winnings < 0:
if winnings == -1:
finalWinnings += user+" lost "+str(-1 * winnings)+" GwendoBuck "+reason+"\n"
finalWinnings += getName(user)+" lost "+str(-1 * winnings)+" GwendoBuck "+reason+"\n"
else:
finalWinnings += user+" lost "+str(-1 * winnings)+" GwendoBucks "+reason+"\n"
finalWinnings += getName(user)+" lost "+str(-1 * winnings)+" GwendoBucks "+reason+"\n"
else:
if winnings == 1:
finalWinnings += user+" won "+str(winnings)+" GwendoBuck "+reason+"\n"
finalWinnings += getName(user)+" won "+str(winnings)+" GwendoBuck "+reason+"\n"
else:
finalWinnings += user+" won "+str(winnings)+" GwendoBucks "+reason+"\n"
finalWinnings += getName(user)+" won "+str(winnings)+" GwendoBucks "+reason+"\n"
money.addMoney(user,netWinnings)