✨ Framework for Hangman
This commit is contained in:
@ -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):
|
||||
@ -233,4 +234,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))
|
||||
|
Reference in New Issue
Block a user