🤖 Better AI
This commit is contained in:
15
Gwendolyn.py
15
Gwendolyn.py
@ -32,7 +32,7 @@ async def fiar(channel,command,user):
|
||||
oldImage = await channel.send(file = discord.File("resources/games/4InARowBoards/board"+str(channel)+".png"))
|
||||
if gameDone == False:
|
||||
if gwendoTurn:
|
||||
await asyncio.sleep(2)
|
||||
await asyncio.sleep(1)
|
||||
response, showImage, deleteImage, gameDone, gwendoTurn = fourInARowAI(str(channel))
|
||||
await channel.send(response)
|
||||
logThis(response,str(channel))
|
||||
@ -67,11 +67,22 @@ async def fiar(channel,command,user):
|
||||
await oldImage.add_reaction("7️⃣")
|
||||
except:
|
||||
logThis("Image deleted before I could react to all of them")
|
||||
|
||||
# else:
|
||||
# with open("resources/games/oldImages/fourInARow"+str(channel), "w") as f:
|
||||
# f.write(str(oldImage.id))
|
||||
|
||||
if gameDone:
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
try:
|
||||
with open("resources/games/oldImages/fourInARow"+str(channel), "r") as f:
|
||||
oldImage = await channel.fetch_message(int(f.read()))
|
||||
|
||||
await oldImage.delete()
|
||||
except:
|
||||
logThis("The old image was already deleted")
|
||||
|
||||
winner = data["4 in a row games"][str(channel)]["winner"]
|
||||
if winner != 0:
|
||||
with open("resources/games/games.json","w") as f:
|
||||
|
Reference in New Issue
Block a user