Converted hangman to use buttons

This commit is contained in:
NikolajDanger
2021-08-19 15:37:02 +02:00
parent 98988efa4b
commit b8a2f6022e
7 changed files with 297 additions and 241 deletions

View File

@ -164,9 +164,6 @@ class Hangman():
ctx: SlashContext
The context of the command.
"""
for msg_id in messages:
msg = await ctx.channel.fetch_message(msg_id)
await msg.delete()
self.bot.log("Deleting old messages")
@ -175,6 +172,10 @@ class Hangman():
file_path = f"{boards_path}hangman_board{game_id}.png"
os.remove(file_path)
for msg_id in messages:
msg = await ctx.channel.fetch_message(msg_id)
await msg.delete()
async def guess(self, ctx: ComponentContext, guess: str, word: str,
guessed_letters: str, game_id: str, *messages: list[str]):
"""
@ -189,9 +190,6 @@ class Hangman():
guess: str
The guess.
"""
for msg_id in messages:
msg = await ctx.channel.fetch_message(msg_id)
await msg.delete()
misses = 0
guessed_letters += guess
@ -293,6 +291,10 @@ class Hangman():
os.remove(file_path)
for msg_id in messages:
msg = await ctx.channel.fetch_message(msg_id)
await msg.delete()