This commit is contained in:
jona605a
2020-08-07 23:31:14 +02:00
13 changed files with 321 additions and 31 deletions

View File

@@ -8,6 +8,7 @@ from .fourInARow import parseFourInARow, fourInARowAI
from .blackjack import blackjackContinue, blackjackFinish
from .hex import parseHex, hexAI
from .monopoly import parseMonopoly, monopolyContinue
from .hangman import parseHangman
# Deletes a message
async def deleteMessage(imageLocation,channel):
@@ -238,4 +239,17 @@ async def runMonopoly(channel, command, user):
await oldImage.add_reaction("🎲")
except:
logThis("Image deleted before I could react to all of them")
async def runHangman(channel,user,command = "start"):
try:
response, showImage, deleteImage, remainingLetters = parseHangman(str(channel.id),user,command)
except:
logThis("Error parsing command (error code 1701)")
await channel.send(response)
logThis(response,str(channel.id))
if showImage:
if deleteImage:
oldImage = await deleteMessage("hangman"+str(channel.id),channel)
oldImage = await channel.send(file = discord.File("resources/games/hangmanBoards/hangmanBoard"+str(channel.id)+".png"))
with open("resources/games/oldImages/hangman"+str(channel.id), "w") as f:
f.write(str(oldImage.id))