🧹 Moved blacjack function
This commit is contained in:
@@ -146,53 +146,6 @@ async def fiar(channel,command,user):
|
||||
|
||||
deleteGame("4 in a row games",str(channel.id))
|
||||
|
||||
# Loop of blackjack game rounds
|
||||
async def blackjackLoop(channel,gameRound,gameID):
|
||||
logThis("Loop "+str(gameRound),str(channel.id))
|
||||
|
||||
with open("resources/games/oldImages/blackjack"+str(channel.id), "r") as f:
|
||||
oldImage = await channel.fetch_message(int(f.read()))
|
||||
|
||||
new_message, allStanding, gamedone = blackjackContinue(str(channel.id))
|
||||
if new_message != "":
|
||||
logThis(new_message,str(channel.id))
|
||||
await channel.send(new_message)
|
||||
if gamedone == False:
|
||||
await oldImage.delete()
|
||||
oldImage = await channel.send(file = discord.File("resources/games/blackjackTables/blackjackTable"+str(channel.id)+".png"))
|
||||
with open("resources/games/oldImages/blackjack"+str(channel.id), "w") as f:
|
||||
f.write(str(oldImage.id))
|
||||
|
||||
try:
|
||||
if allStanding:
|
||||
await asyncio.sleep(5)
|
||||
else:
|
||||
await asyncio.sleep(120)
|
||||
except:
|
||||
logThis("Loop "+str(gameRound)+" interrupted (error code 1321)")
|
||||
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
if str(channel.id) in data["blackjack games"]:
|
||||
realRound = data["blackjack games"][str(channel.id)]["round"]
|
||||
realGameID = data["blackjack games"][str(channel.id)]["id"]
|
||||
|
||||
if gameRound == realRound and realGameID == gameID:
|
||||
if gamedone == False:
|
||||
logThis("Loop "+str(gameRound)+" calling blackjackLoop()",str(channel.id))
|
||||
await blackjackLoop(channel,gameRound+1,gameID)
|
||||
else:
|
||||
try:
|
||||
new_message = blackjackFinish(str(channel.id))
|
||||
except:
|
||||
logThis("Something fucked up (error code 1310)")
|
||||
await channel.send(new_message)
|
||||
else:
|
||||
logThis("Ending loop on round "+str(gameRound),str(channel.id))
|
||||
else:
|
||||
logThis("Ending loop on round "+str(gameRound),str(channel.id))
|
||||
|
||||
async def runMonopoly(channel, command, user):
|
||||
try:
|
||||
response, showImage, deleteImage, gameStarted, gameContinue = parseMonopoly(command,str(channel.id),user)
|
||||
|
||||
Reference in New Issue
Block a user