✨ Blackjack doesn't wait
This commit is contained in:
72
Gwendolyn.py
72
Gwendolyn.py
@ -38,17 +38,22 @@ async def blackjackLoop(channel,gameRound):
|
||||
if allStanding:
|
||||
await asyncio.sleep(5)
|
||||
else:
|
||||
await asyncio.sleep(30)
|
||||
await asyncio.sleep(120)
|
||||
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
realRound = json.load(f)["blackjack games"][str(channel)]["round"]
|
||||
data = json.load(f)
|
||||
|
||||
if gameRound == realRound:
|
||||
if gamedone == False:
|
||||
await blackjackLoop(channel,gameRound+1)
|
||||
if str(channel) in data["blackjack games"]:
|
||||
realRound = data["blackjack games"][str(channel)]["round"]
|
||||
|
||||
if gameRound == realRound:
|
||||
if gamedone == False:
|
||||
await blackjackLoop(channel,gameRound+1)
|
||||
else:
|
||||
new_message = blackjackFinish(str(channel))
|
||||
await channel.send(new_message)
|
||||
else:
|
||||
new_message = blackjackFinish(str(channel))
|
||||
await channel.send(new_message)
|
||||
logThis("Ending loop on round "+str(gameRound))
|
||||
else:
|
||||
logThis("Ending loop on round "+str(gameRound))
|
||||
|
||||
@ -460,7 +465,7 @@ async def parseCommands(message,content):
|
||||
# Hitting
|
||||
elif content.startswith("blackjack hit"):
|
||||
if content == "blackjack hit" or content == "blackjack hit ":
|
||||
response = blackjackHit(str(message.channel),message.author.display_name)
|
||||
response= blackjackHit(str(message.channel),message.author.display_name)
|
||||
else:
|
||||
commands = content.split(" ")
|
||||
try:
|
||||
@ -469,39 +474,64 @@ async def parseCommands(message,content):
|
||||
handNumber = 0
|
||||
response = blackjackHit(str(message.channel),message.author.display_name,handNumber)
|
||||
|
||||
if response == "accept":
|
||||
if response.startswith("accept"):
|
||||
await message.add_reaction("👍")
|
||||
try:
|
||||
if response[6] == "T":
|
||||
await blackjackLoop(message.channel,int(response[7:])+1)
|
||||
except:
|
||||
logThis("Something fucked up")
|
||||
await message.channel.send("something fucked up")
|
||||
else:
|
||||
await message.channel.send(response)
|
||||
|
||||
|
||||
# Standing
|
||||
elif content.startswith("blackjack stand"):
|
||||
response = blackjackStand(str(message.channel),message.author.display_name,0)
|
||||
if response == "accept":
|
||||
|
||||
if response.startswith("accept"):
|
||||
await message.add_reaction("👍")
|
||||
try:
|
||||
if response[6] == "T":
|
||||
await blackjackLoop(message.channel,int(response[7:])+1)
|
||||
except:
|
||||
logThis("Something fucked up")
|
||||
await message.channel.send("something fucked up")
|
||||
else:
|
||||
await message.channel.send(response)
|
||||
|
||||
# Doubling bet
|
||||
elif content.startswith("blackjack double"):
|
||||
if content == "blackjack hit" or content == "blackjack hit ":
|
||||
response = blackjackDouble(str(message.channel),message.author.display_name)
|
||||
else:
|
||||
commands = content.split(" ")
|
||||
try:
|
||||
handNumber = int(commands[2])
|
||||
except:
|
||||
handNumber = 0
|
||||
response = blackjackDouble(str(message.channel),message.author.display_name,handNumber)
|
||||
commands = content.split(" ")
|
||||
try:
|
||||
handNumber = int(commands[2])
|
||||
except:
|
||||
handNumber = 0
|
||||
response, roundDone = blackjackDouble(str(message.channel),message.author.display_name,handNumber)
|
||||
|
||||
await message.channel.send(response)
|
||||
await message.channel.send(response)
|
||||
|
||||
try:
|
||||
if roundDone[0] == "T":
|
||||
await blackjackLoop(message.channel,int(roundDone[1:])+1)
|
||||
except:
|
||||
logThis("Something fucked up")
|
||||
await message.channel.send("something fucked up")
|
||||
|
||||
# Splitting hand
|
||||
elif content.startswith("blackjack split"):
|
||||
response = blackjackSplit(str(message.channel),message.author.display_name)
|
||||
response, roundDone = blackjackSplit(str(message.channel),message.author.display_name)
|
||||
|
||||
await message.channel.send(response)
|
||||
|
||||
#try:
|
||||
if roundDone[0] == "T":
|
||||
await blackjackLoop(message.channel,int(roundDone[1:])+1)
|
||||
#except:
|
||||
# logThis("Something fucked up")
|
||||
# await message.channel.send("something fucked up")
|
||||
|
||||
# Returning current hi-lo value
|
||||
elif content.startswith("blackjack hilo") and message.author.display_name == "Nikolaj":
|
||||
with open("resources/games/hilo.txt", "r") as f:
|
||||
|
Reference in New Issue
Block a user