From 97188720129947697c14d3b26a9aaec2adf1396b Mon Sep 17 00:00:00 2001 From: ajax146 <31014239+ajax146@users.noreply.github.com> Date: Wed, 15 Oct 2025 16:50:09 -0400 Subject: [PATCH] Fixes the hangman started by footer --- techsupport_bot/commands/hangman.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/techsupport_bot/commands/hangman.py b/techsupport_bot/commands/hangman.py index fc599db2..555acba3 100644 --- a/techsupport_bot/commands/hangman.py +++ b/techsupport_bot/commands/hangman.py @@ -402,7 +402,7 @@ async def start_game( return # Create and send the initial game embed - embed = await self.generate_game_embed(interaction, game) + embed = await self.generate_game_embed(interaction, game, interaction.user) message = await interaction.channel.send(embed=embed) self.games[interaction.channel_id] = { "user": interaction.user, @@ -456,7 +456,7 @@ async def guess(self: Self, ctx: commands.Context, letter: str) -> None: return correct = game.guess(letter) - embed = await self.generate_game_embed(ctx, game) + embed = await self.generate_game_embed(ctx, game, game_data.get("user")) message = game_data.get("message") await message.edit(embed=embed) @@ -470,6 +470,7 @@ async def generate_game_embed( self: Self, ctx_or_interaction: discord.Interaction | commands.Context, game: HangmanGame, + owner: discord.Member, ) -> discord.Embed: """ Generates an embed representing the current state of the Hangman game. @@ -481,6 +482,7 @@ async def generate_game_embed( game (HangmanGame): The current instance of the Hangman game, used to retrieve game state, including word state, remaining guesses, and the hangman drawing. + owner (discord.Member): The owner of the game Returns: discord.Embed: An embed displaying the current game state, including @@ -529,13 +531,7 @@ async def generate_game_embed( inline=False, ) - # Determine the game creator based on interaction type - if isinstance(ctx_or_interaction, discord.Interaction): - footer_text = f"Game started by {ctx_or_interaction.user}" - elif isinstance(ctx_or_interaction, commands.Context): - footer_text = f"Game started by {ctx_or_interaction.author}" - else: - footer_text = " " + footer_text = f"Game started by {owner}" embed.set_footer(text=footer_text) return embed @@ -562,7 +558,9 @@ async def redraw(self: Self, ctx: commands.Context) -> None: except discord.errors.NotFound: pass - embed = await self.generate_game_embed(ctx, game_data.get("game")) + embed = await self.generate_game_embed( + ctx, game_data.get("game"), game_data.get("user") + ) new_message = await ctx.send(embed=embed) game_data["message"] = new_message @@ -659,6 +657,6 @@ async def add_guesses( ) # Update the game embed - embed = await self.generate_game_embed(ctx, game) + embed = await self.generate_game_embed(ctx, game, game_data.get("user")) message = game_data.get("message") await message.edit(embed=embed)