✨ Converted all hangman functionality to slash commands
This commit is contained in:
@ -90,43 +90,6 @@ class GameLoops():
|
||||
|
||||
self.bot.databaseFuncs.deleteGame("connect 4 games",channelId)
|
||||
|
||||
async def runHangman(self,channel,user,command = "start", ctx = None):
|
||||
try:
|
||||
response, showImage, deleteImage, remainingLetters = self.bot.games.hangman.parseHangman(str(channel.id),user,command)
|
||||
except:
|
||||
self.bot.log("Error parsing command (error code 1701)")
|
||||
if response != "":
|
||||
if ctx is None:
|
||||
await channel.send(response)
|
||||
else:
|
||||
await ctx.send(response)
|
||||
self.bot.log(response,str(channel.id))
|
||||
if showImage:
|
||||
if deleteImage:
|
||||
await self.deleteMessage("hangman"+str(channel.id),channel)
|
||||
oldImage = await channel.send(file = discord.File("resources/games/hangmanBoards/hangmanBoard"+str(channel.id)+".png"))
|
||||
|
||||
if len(remainingLetters) > 15:
|
||||
otherMessage = await channel.send("_ _")
|
||||
reactionMessages = {oldImage : remainingLetters[:15],otherMessage : remainingLetters[15:]}
|
||||
else:
|
||||
otherMessage = ""
|
||||
reactionMessages = {oldImage : remainingLetters}
|
||||
|
||||
oldMessages = str(oldImage.id)
|
||||
if otherMessage != "":
|
||||
oldMessages += "\n"+str(otherMessage.id)
|
||||
with open("resources/games/oldImages/hangman"+str(channel.id), "w") as f:
|
||||
f.write(oldMessages)
|
||||
|
||||
try:
|
||||
for message, letters in reactionMessages.items():
|
||||
for letter in letters:
|
||||
emoji = chr(ord(letter)+127397)
|
||||
await message.add_reaction(emoji)
|
||||
except:
|
||||
self.bot.log("Image deleted before adding all reactions")
|
||||
|
||||
# Runs Hex
|
||||
async def runHex(self,ctx,command,user):
|
||||
channelId = ctx.channel_id
|
||||
|
Reference in New Issue
Block a user