✨ Four in a row win
This commit is contained in:
13
Gwendolyn.py
13
Gwendolyn.py
@ -576,7 +576,7 @@ async def parseCommands(message,content):
|
||||
|
||||
# Runs a game of four in a row
|
||||
elif content.startswith("fourinarow"):
|
||||
response, showImage, deleteImage = parseFourInARow(content.replace("fourinarow",""),str(message.channel),message.author.display_name)
|
||||
response, showImage, deleteImage, gameDone = parseFourInARow(content.replace("fourinarow",""),str(message.channel),message.author.display_name)
|
||||
await message.channel.send(response)
|
||||
logThis(response,str(message.channel))
|
||||
if showImage:
|
||||
@ -590,6 +590,17 @@ async def parseCommands(message,content):
|
||||
oldImage = await message.channel.send(file = discord.File("resources/games/4InARowBoards/board"+str(message.channel)+".png"))
|
||||
with open("resources/games/oldImages/fourInARow"+str(message.channel), "w") as f:
|
||||
f.write(str(oldImage.id))
|
||||
|
||||
if gameDone:
|
||||
with open("resources/games/games.json", "r") as f:
|
||||
data = json.load(f)
|
||||
|
||||
del data["4 in a row games"][str(message.channel)]
|
||||
|
||||
with open("resources/games/games.json","w") as f:
|
||||
json.dump(data,f,indent=4)
|
||||
|
||||
|
||||
|
||||
# Not a command
|
||||
else:
|
||||
|
Reference in New Issue
Block a user