aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Cam Caswell <[email protected]>2021-09-05 00:56:58 -0400
committerGravatar Cam Caswell <[email protected]>2021-09-24 22:02:48 -0400
commite7bbd14f95f59593581a8c18da8bc4ef9a0f6208 (patch)
treea2db1732b01dfab62fc5f9c3734f918f213c516f
parentSplit initial embed in two (diff)
Add function for appending to claimed answers embed
-rw-r--r--bot/exts/fun/duck_game.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/bot/exts/fun/duck_game.py b/bot/exts/fun/duck_game.py
index eb509e55..1fdc05be 100644
--- a/bot/exts/fun/duck_game.py
+++ b/bot/exts/fun/duck_game.py
@@ -248,7 +248,7 @@ class DuckGamesDirector(commands.Cog):
if answer in game.solutions:
game.claimed_answers[answer] = msg.author
game.scores[msg.author] += CORRECT_SOLN
- await self.display_claimed_answer(game, msg.author, answer)
+ await self.append_to_found_embed(game, f"{str(answer):12s} - {msg.author.display_name}")
else:
await msg.add_reaction(EMOJI_WRONG)
game.scores[msg.author] += INCORRECT_SOLN
@@ -276,6 +276,16 @@ class DuckGamesDirector(commands.Cog):
)
return await ctx.send(embed=embed)
+ async def append_to_found_embed(self, game: DuckGame, text: str) -> None:
+ """Append text to the claimed answers embed."""
+ async with game.editing_embed:
+ found_embed, = game.found_msg.embeds
+ old_desc = found_embed.description
+ if old_desc == discord.Embed.Empty:
+ old_desc = ""
+ found_embed.description = f"{old_desc.rstrip()}\n{text}"
+ await game.found_msg.edit(embed=found_embed)
+
async def display_claimed_answer(self, game: DuckGame, author: discord.Member, answer: tuple[int]) -> None:
"""Add a claimed answer to the game embed."""
async with game.editing_embed: