From dac2a5170f8d3d7c4d144207a32d13c1557a4e45 Mon Sep 17 00:00:00 2001 From: Simon Junod Date: Mon, 18 Apr 2022 19:26:15 +0200 Subject: [PATCH] Give away the previous target word when resetting a wordle game, if it hadn't been found. --- cambot/wordle.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cambot/wordle.py b/cambot/wordle.py index 0c34a8e..c8506fb 100644 --- a/cambot/wordle.py +++ b/cambot/wordle.py @@ -46,6 +46,9 @@ class Game: self.tried = None async def reset(self): + output = "" + if self.target and not self.winner: + output = f"Le mot précédent était : `{self.target}`\n\n" self.target = random.choice(tuple(x for x in target_words if len(x) >= WORDLE_MINLENGTH)) self.winner = None self.tries = 0 @@ -53,7 +56,8 @@ class Game: self.scores = defaultdict(int) self.tried = set() await self.channel.edit(slowmode_delay=WORDLE_SLOWMODE) - await self.channel.send(f"Il y a un nouveau mot à deviner ! Il fait {len(self.target)} lettres.") + output += f"Il y a un nouveau mot à deviner ! Il fait {len(self.target)} lettres." + await self.channel.send(output) async def parse(self, message): guess = unidecode(message.content.strip()).upper()